Drawing weight values on edges (newbie)

Hi,

Following this example
<http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/Drawing-properties-newbie-question-td3069446.html&gt;
, I try to draw the weight values on a graph as follow:

import graph_tool.all as gt
import numpy as np
mG = gt.Graph(directed = False)

#Defining properties
edgeP_image = mG.new_edge_property("object")
edgeP_weight = mG.new_edge_property("double")
vertexP_image= mG.new_edge_property("object")

mG.edge_properties["image"] = edgeP_image
mG.edge_properties["weight"] = edgeP_weight

#Building a multigraphgraph
v1 = mG.add_vertex()
v2 = mG.add_vertex()
v3 = mG.add_vertex()
mG.add_edge(v1,v1)
mG.add_edge(v1,v2)
mG.add_edge(v1,v2)
mG.add_edge(v2,v3)
mG.add_edge(v1,v3)

print mG.list_properties()
# How to set the edge weight?
e1 = mG.edge(v1,v2)
print e1.target()

edgeP_weight[e1]=5

np.random.seed(42)
for e in mG.edges():
    edgeP_weight[e]=np.random.randint(1,20)
    print e
gt.graph_draw(mG, eprops={"len": edgeP_weight}, output_size=(260, 260))

And this code produces the following graph:
<http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/file/n4025568/multigraph_noweight.png&gt;

I tried different variations without success:
     {"double": edgeP_weight}
     {"weight": edgeP_weight}

Best regards

Jean-Patrick

You should use:

    gt.graph_draw(mG, edge_pen_width=edgeP_weight, output_size=(260, 260))

Take a careful look at the documentation available for the graph_draw()
function, which explains everything.

Best,
Tiago

Thanks a lot,

Jean-Patrick

<http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/file/n4025580/multigraph_weighted.png&gt;