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

Many thanks,


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():

for more information.


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.