Node Pair list from a graph

조회 수: 3 (최근 30일)
Hari
Hari 2020년 10월 4일
댓글: Hari 2020년 10월 4일
How can I get a matrix of node pairs from a graph? That is, if there are 4 nodes 1,2,3,4, then the node pair matrix would be :
1 2
1 3
1 4
2 3
2 4
3 4
I could do this using 2 for loops, but is there any quick way of doing it?

채택된 답변

Bruno Luong
Bruno Luong 2020년 10월 4일
nchoosek(1:4,2)

추가 답변 (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