How to find shortest path length by adjacency matrix?

31 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Graph and Network Algorithms 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by