Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
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?

Réponse acceptée

Matt J
Matt J le 16 Mar 2022
Modifié(e) : Matt J le 16 Mar 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 commentaires

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graph and Network Algorithms dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by