开发者

How can I get node coordinates from a graph, using Perl?

Ok, I have a flowchart definition (basically, array of nodes and edges for each node). Now I want to calculate coordinates for every task in the flow, preferably hierarchycal style.

I need something like Graph::Easy::Layout but I have no idea how to get nodes coordinates: I render nodes myself and I only want to retrieve box开发者_运维技巧 coordinates/size. Any suggestions?

What I need is a CPAN module available even in Debian repository.


You can convert a tarball from CPAN into a Debian package. See What’s the best way to turn CPAN modules into Debian packages?

There you will find lots of good advice and links. There's even some discussion there as to why it might be a bad idea to install modules in this way.


Update

For layout with information on coordinates, Graph::Layout::Aesthetic is probably your best bet.

Most of the other packages on CPAN produce graphs in some description language (such as Graphviz DOT, GraphML or GDL) and rely on other graph layout libraries to handle actual layout tasks. Specific examples would be Graphviz and aisee.

Asking for the coordinates of a node (vertex) from one of these libraries is analogous to asking for the coordinates of a <P> tag from HTML::TreeBuilder.

There is a package called Graph::Renderer on CPAN but it looks very incomplete, so I hesitate to recommend it. But it may be usable for your needs.

Graph::Easy::As_svg actually lays out graphs and so may be modifiable to meet your needs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜