Node Pair list from a graph

2 ビュー (過去 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)
  1 件のコメント
Hari
Hari 2020 年 10 月 4 日
Thanks :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by