19 Mar 2011 18:54
Re: Query regarding graph layout in graph-tool
Tiago de Paula Peixoto <tiago <at> skewed.de>
2011-03-19 17:54:34 GMT
2011-03-19 17:54:34 GMT
Hi Kapil, Sorry for the late reply. On 03/17/2011 10:50 AM, kapil gupta wrote: > I want to know is it possible in graph-tool to nominate a node to be > the centre of the graph and have the layout chose the distance of near > by nodes to be directly proportional to the strength of the edge > weight. The more two nodes correlate, the closer together they are. I'm not sure if I understand precisely what you want, but you can definitely "pin down" the position of a subset of the vertices, and let the layout modify only the remaining ones. You can also set a "len" edge property, which defines the preferred edge length for the layout. Take a look at the full graphviz options at http://www.graphviz.org/content/attrs To use these options with graph-tool, you should do something like: len = g.new_edge_property("double") len.a = 1.0 / weight.a # your edge weight pin = g.new_vertex_property("bool") pin[root] = True # root is the vertex which should be pinned down graph_draw(g, eprops={"len": len}, vprops={"pin": pin}) I hope this helps! Cheers, Tiago -- -- Tiago de Paula Peixoto <tiago <at> skewed.de>
_______________________________________________ graph-tool mailing list graph-tool <at> skewed.de http://lists.skewed.de/mailman/listinfo/graph-tool
RSS Feed