print g.clusters("strong")
<igraph.clustering.VertexClustering object at 0x8defc8c>
Now, how do I acces the members of this object: eg, size of components,
count of components etc?
VertexClustering has a couple of methods that let you do that. First, you can
use VertexClustering as a list, in which case you get the vertex IDs of the
vertices in each component:
cl = g.clusters("strong")
cl[0] # gives you the first component
cl[1] # gives you the second component
len(cl) # gives you the number of components
You can also iterate over it as if it were a list:
for component in cl:
print component
It also has a "membership" property that returns a vector in which element i
contains the index of the component in which vertex i participates:
print cl.membership
If you need the subgraph corresponding to a given connected component (and not
just a list of vertex IDs), use the subgraph() method of the VertexClustering:
g2 = cl.subgraph(0) # returns the first component as another Graph object
Finally, VertexClustering also has a method called sizes(), which returns the
sizes of each component. For more information, type help(Clustering) and
help(VertexClustering).
Hope this helps.
Best,
Tamas
_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help