igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] ?????? ?????? how to find disconn ected components


From: ????????????
Subject: Re: [igraph] ?????? ?????? how to find disconn ected components
Date: Fri, 21 Jun 2013 22:41:37 +0800


OK, I see. components() works well.

Thank you very much~

------------------ Original ------------------
From:  "G??bor Cs??r"<address@hidden>;
Date:  Fri, Jun 21, 2013 10:09 PM
To:  "Help for igraph users"<address@hidden>;
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 <address@hidden> 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
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help


reply via email to

[Prev in Thread] Current Thread [Next in Thread]