Hi, On 08/11/2012 02:53 PM, mstcamus wrote:
Is it possible to show the members of the communities shown in the http://projects.skewed.de/graph-tool/doc/community.html#graph_tool.community... condensation graph documentation. For example, I have a graph in GraphML that I import with the vertex property "_graphml_vertex_id", from which I follow the rest of the example posted in the documentation to produce a condensation graph.
However, I want to see which vertices end up being grouped together. How would one go about reversing the condensation graph to see the groupings? I apologise if my question is silly, I'm still very new to graph-tool, which I think is a remarkable piece of work (thank you!).
All you have to do is search for vertices with a specific value of the property map. You can do this by looping: groups = defaultdict(list) for v in g.vertices(): groups[vertex_id[v]].append(v) # now 'groups' is a dictionary with all the vertices for each group You can also search for individual groups by using the find_vertex() function: http://projects.skewed.de/graph-tool/doc/util.html#graph_tool.util.find_vert... I hope it helps. Cheers, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>