OK, I see. components() works well.

Thank you very much~


------------------ Original ------------------
From:  "G??bor Cs??r"<csardi.ga...@gmail.com>;
Date:  Fri, Jun 21, 2013 10:09 PM
To:  "Help for igraph users"<igraph-help@nongnu.org>; 

Subject:  Re: [igraph]?????? ?????? how to find disconnected components



Actually, I still don't understand what is the goal here. Can you give a simple 
example? SAy a graph with ten vertices, from 'A' to 'J', and some set of edges. 

How would the desired output look for a given input?
 

Gabor



On Fri, Jun 21, 2013 at 10:07 AM, Tam??s Nepusz <nta...@gmail.com> wrote:
 > in fact, i have some big/large graphs, which return FALSE if i call 
 > is_connected().
 > I just want to know if they are disconnected, how many disconnected 
 > components do they have.
 
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:
 
 >>> 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
 igraph-help@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/igraph-help
_______________________________________________
igraph-help mailing list
igraph-help@nongnu.org
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to