graphviz - How to access nodes edges of dot format graph (Generalised ) in haskell -
i want access nodes, edges , properties of 'xdotgraph' (g.dotgraph) , set again. here haskell code prints dot format graph using graphviz:
$ cat example.dot digraph { [type1="", type2=""]; b [type1="", type2=""]; -> b [label=""]; } import data.graphviz import data.text.io t import qualified data.text.lazy b import qualified data.text.lazy.io l import qualified data.graphviz.types.generalised g import data.graphviz.printing xdottext <- l.readfile "example.xdot" let xdotgraph = parsedotgraph xdottext :: g.dotgraph string t.putstrln $ renderdot $ todot xdotgraph
this works me (mostly identical code there few changes):
#!/usr/bin/env stack {- stack runghc --resolver lts-6.0 --package graphviz -} import data.graphviz import data.text.io t import qualified data.text.lazy b import qualified data.text.lazy.io l import qualified data.graphviz.types.generalised g import data.graphviz.printing import data.graphviz.types main = xdottext <- l.readfile "example.dot" let xdotgraph = parsedotgraph xdottext :: g.dotgraph string l.putstrln $ renderdot $ todot xdotgraph print $ graphnodes xdotgraph print $ graphedges xdotgraph
Comments
Post a Comment