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] <ml-node+s982480n4024769...@n3.nabble.com>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]<http://user/SendEmail.jtp?type=node&node=4024769&i=0>>
>
>
>
> _______________________________________________
> graph-tool mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4024769&i=1>
> http://lists.skewed.de/mailman/listinfo/graph-tool
>
> *signature.asc* (566 bytes) Download
> Attachment<http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/attachment/4024769/0/signature.asc>
> --
> Tiago de Paula Peixoto <ti...@skewed.de>
>
>
> ------------------------------
> 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<http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4024768&code=bnVsbHVzYWRpbmZpbml0dW1AZ21haWwuY29tfDQwMjQ3Njh8MTA1ODQ5NTA1MA==>
> .
> NAML<http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context:
http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/Show-Members-of-Community-Condensation-Graph-tp4024768p4024770.html
Sent from the Main discussion list for the graph-tool project mailing list
archive at Nabble.com.
_______________________________________________
graph-tool mailing list
graph-tool@skewed.de
http://lists.skewed.de/mailman/listinfo/graph-tool