Hi Tiago, thank you for the response! I've tried what you said, but I'm still a little stuck. I don't know how to incorporate the group numbers of ng into the loop and associate them with the vertices of g, so all I end up with currently is a dictionary of vertices (and their labels) in the largest component. Here's the code I have. Any help would be greatly appreciated!

import graph_tool.all as gt, collections
from pylab import *

g=gt.load_graph("network.xml")

name = g.vertex_properties['_graphml_vertex_id']
g = gt.GraphView(g, vfilt=gt.label_largest_component(g))
spins = gt.community_structure(g, 1000, 100)
ng = gt.condensation_graph(g, spins)
gt.graphviz_draw(ng[0], overlap=False, output="network.pdf")

groups = collections.defaultdict(list)
for v in g.vertices():
groups[name[v]].append(v)

for a,b in groups.iteritems():
print a,b

On Sat, Aug 11, 2012 at 9:28 PM, Tiago Peixoto [via Main discussion list for the graph-tool project] <[hidden email]> wrote:
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
> 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_vertex


I hope it helps.

Cheers,
Tiago

--
Tiago de Paula Peixoto <[hidden email]>


_______________________________________________
graph-tool mailing list
[hidden email]
http://lists.skewed.de/mailman/listinfo/graph-tool

signature.asc (566 bytes) Download Attachment
--
Tiago de Paula Peixoto <[hidden email]>



If you reply to this email, your message will be added to the discussion below:
http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/Show-Members-of-Community-Condensation-Graph-tp4024768p4024769.html
To unsubscribe from Show Members of Community Condensation Graph, click here.
NAML



View this message in context: Re: Show Members of Community Condensation Graph
Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.