How to find shortest path length by adjacency matrix?

30 visualizaciones (últimos 30 días)
eyal atias
eyal atias el 14 de Mayo de 2021
Editada: Matt J el 14 de Mayo de 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.

Respuesta aceptada

Matt J
Matt J el 14 de Mayo de 2021
Editada: Matt J el 14 de Mayo de 2021
Use the adjacency matrix A to create a graph object, and then use the distances() command.
distanceMatrix=distances(graph(A))

Más respuestas (0)

Categorías

Más información sobre Graph and Network Algorithms en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by