This repository was archived by the owner on Jan 28, 2022. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork0
A BuckleScript interface for dagre, a directed graph layout for JavaScript
License
NotificationsYou must be signed in to change notification settings
arnau/bs-dagre
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
BuckleScript bindings fordagre.
Although most names come straight from the original library, there are a fewchanges to adapt to Reason and a few aliases for my own benefit.
- Bindings for
graphlib
ara under theDagre.Graph
module. - Bindings for
dagre
are under theDagre.Layout
module. graphlib
uses "label" to refer to data associated with graph, nodes andedges.bs-dagre
uses "attributes" instead. For example, instead ofsetDefaultNodeLabel
you havesetDefaultNodeAttrs
.
The steps to compute a graph layout are: create a graph, add nodes and edgesand finally create a layout.
openDagre;letgraph=Graph.make();Graph.setDefaultEdgeAttrs(graph,()=> {"minlen":2});
The snippet above creates a graph with default attributes,if you need to tweak them, useGraph.Attrs.make
.
Graph.setNodeWith(graph,"a",Node.attrs(~label="first", ~width=20, ~height=20),());Graph.setNodeWith(graph,"b",Node.attrs(~label="second", ~width=20, ~height=20),());Graph.setEdge(graph,Edge.t(~v="a", ~w="b",()));
letlayout=Layout.make(graph);// Use the layout to render the graph.
Check theexamples
for more.
bs-dagre is licensed under the terms of the MIT License. See the LICENSE filefor details.
About
A BuckleScript interface for dagre, a directed graph layout for JavaScript
Topics
Resources
License
Stars
Watchers
Forks
Packages0
No packages published