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!).
-- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
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
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+s982480n4024769h81@n3.nabble.comwrote:
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 <[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 Attachmenthttp://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/attachment/4024769/0/signature.asc
Tiago de Paula Peixoto tiago@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/... To unsubscribe from Show Members of Community Condensation Graph, click herehttp://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4024768&code=bnVsbHVzYWRpbmZpbml0dW1AZ21haWwuY29tfDQwMjQ3Njh8MTA1ODQ5NTA1MA== . NAMLhttp://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/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
On 08/11/2012 05:01 PM, mstcamus wrote:
groups = collections.defaultdict(list) for v in g.vertices(): groups[name[v]].append(v)
Here you have to use the same property as you used to build the condensation graph, which in your case is "spins", instead of "name".
Cheers, Tiago
That fixed it! Thanks so much. Sorry about being noob, but I'm learning a lot. Hopefully my question can help other newcomers. I think this is definitely the best network analysis library around; it's so well-documented, and I hope to contribute to the graph-tool community in whatever way I can as soon as I understand it better. You should be very proud of your work. :)
On Sun, Aug 12, 2012 at 12:03 AM, Tiago Peixoto [via Main discussion list for the graph-tool project] ml-node+s982480n4024771h43@n3.nabble.comwrote:
On 08/11/2012 05:01 PM, mstcamus wrote:
groups = collections.defaultdict(list) for v in g.vertices(): groups[name[v]].append(v)
Here you have to use the same property as you used to build the condensation graph, which in your case is "spins", instead of "name".
Cheers, Tiago
-- Tiago de Paula Peixoto <[hidden email]http://user/SendEmail.jtp?type=node&node=4024771&i=0>
graph-tool mailing list [hidden email] http://user/SendEmail.jtp?type=node&node=4024771&i=1 http://lists.skewed.de/mailman/listinfo/graph-tool
*signature.asc* (566 bytes) Download Attachmenthttp://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/attachment/4024771/0/signature.asc
Tiago de Paula Peixoto tiago@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/... To unsubscribe from Show Members of Community Condensation Graph, click herehttp://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4024768&code=bnVsbHVzYWRpbmZpbml0dW1AZ21haWwuY29tfDQwMjQ3Njh8MTA1ODQ5NTA1MA== . NAMLhttp://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/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
On 08/11/2012 06:12 PM, mstcamus wrote:
That fixed it! Thanks so much. Sorry about being noob, but I'm learning a lot. Hopefully my question can help other newcomers. I think this is definitely the best network analysis library around; it's so well-documented, and I hope to contribute to the graph-tool community in whatever way I can as soon as I understand it better. You should be very proud of your work. :)
Thank you very much!
Cheers, Tiago
-- Tiago de Paula Peixoto tiago@skewed.de