How to find shortest path length by adjacency matrix?

조회 수: 31 (최근 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 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