Skip to content

graphviz renderer bindings for purescript using viz.js

Notifications You must be signed in to change notification settings

csicar/purescript-graphviz

Repository files navigation

Purescript-Graphviz

renders Graphs defined in Data.DotLang to SVG, JSON and XDOT.

let g = DiGraph [
    node "a" [ Shape Diamond, Style Filled,  FillColor red ],
    node "b" [],
    "a" ==> "b",
    "a" ==> "d",
    Subgraph [
        node "d" []
    ]
]
let rendered = renderToSvg Dot g

rendered will be:

example image

Installation

Spago

additions =
   { graphviz =
      { dependencies =
         [ "aff"
         , "console"
         , "dotlang"
         , "effect"
         , "functions"
         , "node-fs"
         , "node-fs-aff"
         , "prelude"
         , "psci-support"
         , "test-unit"
         ]
      , repo = "https://github.com/csicar/purescript-graphviz"
      , version = "v1.1.0" 
      }
   }
spago install graphviz

Development

Running Tests

$ spago install
$ npm install # for running tests in node
$ spago test