nullPointer
nullPointer

Reputation: 4574

Coordinates algorithm for drawing graph nodes

I'm trying to generate a simple graph via java based on a source xml file that contains the nodes entities of the graph. So each node may have 0 (single root node ) or more parents. Is there any good coordinates drawing algorithm / pseudocode which would draw children below their parents in a nice and readable layout ?

many thanks

Upvotes: 0

Views: 344

Answers (1)

Botje
Botje

Reputation: 30840

The default layout algorithm (dot) used by GraphViz is well-suited for trees. This SO comment links to the technical description and algorithm. If you cannot use GraphViz itself, at least you can get a head start on the algorithm.

Upvotes: 1

Related Questions