フィルターのクリア

How can you remove all sub-graphs that are not part of the largest component of connected sub-graphs?

1 回表示 (過去 30 日間)
I imagine generating equivalence relations between the sub-graphs and doing some sort of union-find operation would be the way to go about this, but how to do this? Can somebody give an example?

採用された回答

Matt J
Matt J 2022 年 3 月 16 日
編集済み: Matt J 2022 年 3 月 16 日
Given a agraph, G,
bins=biconncomp(G);
[~,cmaj]=max(histcounts(bins,1:max(bins)+1));
ekeep=find(bins==cmaj);
[sk,tk]=findedge(G,ekeep);
G=graph(sk,tk);
  4 件のコメント
L'O.G.
L'O.G. 2022 年 3 月 16 日
編集済み: L'O.G. 2022 年 3 月 16 日
Thank you both.

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by