for more information visit the package's GitHub page
Package contains the following modules:
Sugiyama Style graph drawing in pure elm. It is an elm implementation of popular js library dagrejs. The package can be use to draw all kinds of graphs including trees efficiently.
The package exposes two modules
In most use cases you will need to use Render. The Dagre is exposed in case you want to embed this in some other rendering library.
See an example in action on Ellie.
See more end-to-end example code in the examples/
folder.
import Graph as G
import Html
import Render as R
simpleGraph : G.Graph Int ()
simpleGraph =
G.fromNodeLabelsAndEdgePairs
[ 0, 1, 2, 3, 4, 5, 6, 7 ]
[ ( 3, 4 )
, ( 2, 0 )
, ( 6, 1 )
, ( 3, 6 )
, ( 1, 3 )
, ( 3, 0 )
, ( 1, 2 )
, ( 7, 2 )
, ( 1, 1 )
, ( 4, 1 )
, ( 0, 7 )
, ( 4, 5 )
, ( 3, 2 )
, ( 6, 7 )
, ( 1, 7 )
, ( 3, 0 )
, ( 6, 1 )
, ( 4, 3 )
, ( 0, 4 )
, ( 6, 0 )
]
main : Html.Html msg
main =
R.draw
[ ]
[ R.style "height: 100vh;"
]
simpleGraph
Please visit the elm-dagre's wiki for learning more about the library and contributing to it.
If you find a bug please report it using the github issues.
This project is inspired from dagrejs. Thanks contributors@dagrejs for your hard work. (Original MIT License).