How to check if there is an edge between two nodes in an undirected graph?
조회 수: 22 (최근 30일)
이전 댓글 표시
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
채택된 답변
Christine Tobler
2022년 5월 20일
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.
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 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!