amit
amit

Reputation: 3462

"playing" with the graphviz dot/neatu layout

I'm working on an application that draw graphs. I like very much the work done by graphviz/dot/neatu algorithms. However, as I understand it, I can only use it as a library to render a graph, and cannot "play" with how the algorithm works.

Specifically I need 2 things, one on the input side and one on the output side:

on the output side, I need to extract node positions from the layout. In fact, I don't want the library to draw anything, just to return the computed node locations.

on the input side, I know that the dot algorithm computes the "ranks" of nodes based on their edge dependency, and that this rank is then used to compute the y coordinate of the node. However, in my case, I know the rank in advance, and I'd be happy if I can provide that information to the dot algorithm, so it would use my data, and not compute it.

Any clue if and how I can achieve that? I work in python, but can read/write in any language, really.

Upvotes: 0

Views: 114

Answers (1)

marapet
marapet

Reputation: 56566

To answer your first question:

graphviz allows for various output formats, among them text formats which you can read/parse and extract information such as node positions. Take a look at dot, json and plain.

Upvotes: 1

Related Questions