How to find shortest path length by adjacency matrix?

30 Ansichten (letzte 30 Tage)
eyal atias
eyal atias am 14 Mai 2021
Bearbeitet: Matt J am 14 Mai 2021
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.

Akzeptierte Antwort

Matt J
Matt J am 14 Mai 2021
Bearbeitet: Matt J am 14 Mai 2021
Use the adjacency matrix A to create a graph object, and then use the distances() command.
distanceMatrix=distances(graph(A))

Weitere Antworten (0)

Kategorien

Mehr zu Graph and Network Algorithms finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by