On 07/14/2014 09:47 PM, Elleroth wrote: > Hello, > > Say I have an edge property (of type double) with values ranging from 0.0 to > 1.0. I want this value to be set as the alpha for my edges or at least be > used as the offset with the gradient option in the graph_draw function. The > idea is that for edges with stronger weights, I can reduce the alpha. > (Edges weighted at 0.0 will disappear.) How can I make that happen? > > Using graph_draw(..., gradient=[values, 0, 0, 0, 1.0]) will not work, as the > 0th index in the gradient option list must be a value from 0.0-1.0, and not > some set or list or properties. There's got to be a way to do this, though. > It's simple enough; I'm probably just missing something.
You can access the properties as 2d arrays as follows
a = zeros((5, g.num_edges()))
a[0] = values
gradients = g.new_vertex_property("vector<double>")
gradients.set_2d_array(a)
graph_draw(g, gradients=gradients)
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
