Skip to content

Elm implementation of Buchheim, Junger and Leipert's tree layout algorithm

License

Notifications You must be signed in to change notification settings

digital-society-coop/elm-tree-layout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

elm-tree-layout

Elm implementation of Buchheim, Junger and Leipert's tree layout algorithm.

This package exposes treeLayout, which returns a dictionary of node identifiers with x and y coordinates for a given 'distance' (used as a constant for x spacing) and 'nodes' (a list of hierarchy descriptors starting with the root, represented by tuples of node identifier and parent node identifier).

Example usage:

treeLayout 2 [ ( "a", Nothing ), ( "b", Just "a" ), ( "c", Just "a" ) ]
--> (Dict.fromList [ ( "a", { x = 0, y = 1 } ), ( "b", { x = -1, y = 2 } ), ( "c", { x = 1, y = 2 } ) ])

The pseude code written by (Buchheim, Junger and Leipert, 2006) implements aesthetic rules defined by (Walker, 1989) in a linear time for trees of unbounded degree.

This library does not render the tree, so that the rendering logic could be kept separate.

About

Elm implementation of Buchheim, Junger and Leipert's tree layout algorithm

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages