AllPairsShortestPath
AllPairsShortestPath[g]
gives a matrix, where the entry is the length of a shortest path in g between vertices and .
AllPairsShortestPath[g,Parent]
returns a three-dimensional matrix with dimensions 2*V[g]*V[g], in which the entry is the length of a shortest path from to and the entry is the predecessor of in a shortest path from to .
更多信息和选项
- AllPairsShortestPath functionality is now available in the built-in Wolfram Language function GraphDistanceMatrix.
- To use AllPairsShortestPath, you first need to load the Combinatorica Package using Needs["Combinatorica`"].
范例
基本范例 (2)
AllPairsShortestPath has been superseded by GraphDistanceMatrix:
文本
Wolfram Research (2012),AllPairsShortestPath,Wolfram 语言函数,https://reference.wolfram.com/language/Combinatorica/ref/AllPairsShortestPath.html.
CMS
Wolfram 语言. 2012. "AllPairsShortestPath." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/Combinatorica/ref/AllPairsShortestPath.html.
APA
Wolfram 语言. (2012). AllPairsShortestPath. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/Combinatorica/ref/AllPairsShortestPath.html 年