|
SOLUTIONS
|
MATHEMATICA 内置符号
GraphDistanceMatrix
GraphDistanceMatrix[g]
给出图 g 的顶点之间的距离组成的矩阵.
GraphDistanceMatrix[g, d]
给出图 g 中最大距离为 d 的顶点之间的距离组成的矩阵.
更多信息更多信息
- GraphDistanceMatrix 返回一个 SparseArray 对象或者一个普通矩阵.
- 距离矩阵
的元素给出从顶点
到顶点
的最短距离. - 距离矩阵的对角线元素
总是0. - 元素
是 Infinity (
) ,如果从顶点
到顶点
不存在路径. - 在 GraphDistanceMatrix[g, d] 中,一个元素
为 Infinity,如果在 d 步或者更少的步数内,不存在从顶点
到顶点
的路径. - 假设顶点
以 VertexList[g] 的顺序给出.
版本 8 的新功能
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »


