How to find shortest path length by adjacency matrix?

32 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

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

Più risposte (0)

Categorie

Scopri di più su Graph and Network Algorithms in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by