|
From: | ???????????? |
Subject: | Re: [igraph] ?????? ?????? how to find disconn ected components |
Date: | Fri, 21 Jun 2013 22:41:37 +0800 |
> in fact, i have some big/large graphs, which return FALSE if i call is_connected().Gabor has suggested using components() in a previous email, what's wrong with that? components() will give you a VertexClustering object where each cluster corresponds to a connected component of a vertex. You can then call len() on the VertexClustering object to get the number of components:
> I just want to know if they are disconnected, how many disconnected components do they have.
>>> g = Graph.Full(4) * 5
>>> len(g.components())
5
You can also index the result of g.components() as if it were a list to get the indices of the vertices in each of the components:
>>> comp = g.components()
>>> comp[0]
[0, 1, 2, 3]
--
T.
_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help
[Prev in Thread] | Current Thread | [Next in Thread] |