How to find shortest path length by adjacency matrix?

16 ビュー (過去 30 日間)
eyal atias
eyal atias 2021 年 5 月 14 日
編集済み: Matt J 2021 年 5 月 14 日
If I have adjacency matrix(i.e matrix that represent connection between nodes in a network) , i want to get matrix that its (i,j) represent the minimum number of steps from i node to j node giving adjacency matrix.
Thanks.

採用された回答

Matt J
Matt J 2021 年 5 月 14 日
編集済み: Matt J 2021 年 5 月 14 日
Use the adjacency matrix A to create a graph object, and then use the distances() command.
distanceMatrix=distances(graph(A))

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by