Path between 2 nodes in a graph
이전 댓글 표시
How to check if a path exists between two nodes in a graph?
채택된 답변
추가 답변 (1개)
Christine Tobler
2020년 9월 28일
Compute a path between the nodes, then check if the result is empty (this is returned by shortestpath if no path exists):
path = shortestpath(G, firstNode, secondNode)
pathExists = ~isempty(path);
댓글 수: 2
Hari
2020년 10월 4일
Bruno Luong
2020년 10월 4일
Read Michael's answer that suggests using concomp
카테고리
도움말 센터 및 File Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
