Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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?

Akzeptierte Antwort

Matt J
Matt J am 16 Mär. 2022
Bearbeitet: Matt J am 16 Mär. 2022
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 Kommentare

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graph and Network Algorithms finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by