Hi Gustav, On 06/15/2011 10:39 PM, Gustav wrote:
If I try a sentence like
graph_draw(g, eprops={"label": g.edge_properties}, output="two-nodes2.png")
it draws obviously the label for that object which is:
{'occ': <PropertyMap object with key type 'Edge' and value type 'int32_t', for Graph 0x2f6dcd0, at 0x2f6de10>}
But I don't understand which parameter I should pass to graph_draw in order to get the desired outcome.
The attribute g.edge_properties is a dictionary of internal property maps. What you want to so is to pass some property map in isolation, not all of them. What you want to pass depends of course of what you want to do, which is not very clear to me. Suppose, for instance, you have a property map which has numeric value for each edge, which is called "edge_prop", which is created as such: edge_prop = g.new_edge_property("double") for e in g.edges(): edge_prop[e] = random() # fill with random values If you want to draw a label on top of the edges with these values you would do: graph_draw(g, eprops={"label": edge_prop}) If, instead you want it to represent the length of the edge, you would do something like: graph_draw(g, eprops={"len": edge_prop}) Take a look at http://www.graphviz.org/doc/info/attrs.html for all possible properties one can set. Note that for vertex and edge color, as well as size, graph_draw() provides direct parameters, so one does not need to pass anything to eprops or vprops. Cheers, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>