Path between 2 nodes in a graph
Mostra commenti meno recenti
How to check if a path exists between two nodes in a graph?
Risposta accettata
Più risposte (1)
Christine Tobler
il 28 Set 2020
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 Commenti
Hari
il 4 Ott 2020
Bruno Luong
il 4 Ott 2020
Read Michael's answer that suggests using concomp
Categorie
Scopri di più su Graph and Network Algorithms in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
