Visualise categorical attributes read from graphml files (beginner)
Hi Tiago, I am trying to visualise a bipartite network (graphml, created with networkx), where node types are represented by vertex shape and other vertex attributes such as party affiliation by vertex colour and/or size. I would be very grateful for a code sample which could help illustrate how such non-computed attributes are retrieved from loaded graphml file and assigned to the graph. I was not able to figure this out reading through the documentation. Many thanks, Marten -- 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 30.04.2015 11:34, marten wrote:
I am trying to visualise a bipartite network (graphml, created with networkx), where node types are represented by vertex shape and other vertex attributes such as party affiliation by vertex colour and/or size.
I would be very grateful for a code sample which could help illustrate how such non-computed attributes are retrieved from loaded graphml file and assigned to the graph. I was not able to figure this out reading through the documentation.
Did you read the documentation about property maps? For vertex property maps stored in a file, you would access them as: g = load_graph("mygraph.xml") size = g.vp["size"] # print all sizes for v in g.vertices(): print(size[v]) See https://graph-tool.skewed.de/static/doc/quickstart.html#property-maps for more information. Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
Thanks Tiago, finally I could not figure out how to create a new vertex property based on the graphml file I import (it works for everything else) but assigning size, colour etc. variables in networkx already solves the issue for me. Best, Marten -- 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.
participants (2)
-
marten -
Tiago de Paula Peixoto