On 06/13/2014 03:08 PM, jean-patrick wrote: > Hi, > > Following this example > <http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/Drawing-properties-newbie-question-td3069446.html> > , 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))
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
--
Tiago de Paula Peixoto <[email protected]>
signature.asc
Description: OpenPGP digital signature
_______________________________________________ graph-tool mailing list [email protected] http://lists.skewed.de/mailman/listinfo/graph-tool
