How to check if there is an edge between two nodes in an undirected graph?
20 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Waseem AL Aqqad
le 20 Mai 2022
Réponse apportée : Pratibha Chaudhary
le 9 Nov 2022
How can I check if any two nodes in an undirected graph are connected via an edge or not, please? in other words, Are they neighbors or not? Thanks!
0 commentaires
Réponse acceptée
Christine Tobler
le 20 Mai 2022
Call findedge(g, node1, node2). If there is no edge connecting these nodes, the output is zero. Otherwise, the output is the index into the Edges table of the connecting edge.
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Undirected Graphs dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!