Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Jan 28, 2022. It is now read-only.
/bs-dagrePublic archive

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

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BuckleScript bindings fordagre.

Status

  • Bindings forgraphlib public interface.
  • Bindings fordagre public interface.

Naming and organisation

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 forgraphlib ara under theDagre.Graphmodule.
  • Bindings fordagre 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.

Usage

The steps to compute a graph layout are: create a graph, add nodes and edgesand finally create a layout.

Crate a graph

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.

Add nodes and edges

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",()));

Create a layout

letlayout=Layout.make(graph);// Use the layout to render the graph.

Check theexamples for more.

License

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

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp