MathTop

graph_all_pairs_distance 函数

返回所有顶点两两之间的最短路距离矩阵。

语法

  • GraphTheory:-AllPairsDistance(edges)
  • graph_all_pairs_distance(edges)

参数与选项

edges形如 [[u, v], ...] 的边列表。

示例

  1. 全点距离GraphTheory:-AllPairsDistance([[a, b], [b, c], [c, a], [c, d]])返回最短路距离矩阵。