I have graph with 88000 vertices and 5100000 edges.
I would like to have access to size of each cluster and number of clusters. Looks like cl[len(cl)-1] and cl[len(cl)-2] do not have
this information so where could it be in cl? -ishwar On Fri, 6 Apr 2012, Tam??s Nepusz wrote:
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 [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
_______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
