FDG v0.0.4 FDG.Parsers.Graphviz

Parses FDG AST into Graphviz (.dot) syntax, and allows for exporting to Various image formats using Graphviz.

Examples

iex> FDG.Parsers.Graphviz.to_dot([{:node, [label: "A", children: []]}])
"digraph G { a [label=\"A\"]; }"

Summary

Functions

Turns FDG ast tuples into a dot-syntax string, ready to be parsed into a graph using Graphviz

Turns dot syntax into something else using Graphviz. The format attribute can accept anything that Graphviz can. A non-exhausted list being

Turns FDG dot_syntax string into a PNG digraph, using Graphviz's dot command. Returns the filename of the output file output_filename

Turns FDG dot_syntax string into an SVG digraph, using Graphviz's dot command. Returns the filename of the output file output_filename

Functions

to_dot(ast)

Specs

Turns FDG ast tuples into a dot-syntax string, ready to be parsed into a graph using Graphviz.

Examples

iex> FDG.Parsers.Graphviz.to_dot([{:node, [label: "A", children: []]}])
"digraph G { a [label=\"A\"]; }"
to_graphviz(dot_syntax, format, output_filename)

Turns dot syntax into something else using Graphviz. The format attribute can accept anything that Graphviz can. A non-exhausted list being:

  • ps (PostScript)
  • svg and svgz (Structured Vector Graphics)
  • fig (XFIG Graphics)
  • png and gif (Bitmap Graphics)
  • imap and cmapx

Examples

iex> FDG.Parsers.Graphviz.to_dot([{:node, [label: "A", children: []]}])
...> |> FDG.Parsers.Graphviz.to_graphviz("ps", "graph")
{:ok, "graph.ps"}
to_png(dot_syntax, output_filename)

Specs

to_png(String.t, String.t) :: {atom, String.t}

Turns FDG dot_syntax string into a PNG digraph, using Graphviz's dot command. Returns the filename of the output file output_filename.

Examples

iex> FDG.Parsers.Graphviz.to_dot([{:node, [label: "A", children: []]}])
...> |> FDG.Parsers.Graphviz.to_png("graph")
{:ok, "graph.png"}
to_svg(dot_syntax, output_filename)

Specs

to_svg(String.t, String.t) :: {atom, String.t}

Turns FDG dot_syntax string into an SVG digraph, using Graphviz's dot command. Returns the filename of the output file output_filename.

Examples

iex> FDG.Parsers.Graphviz.to_dot([{:node, [label: "A", children: []]}])
...> |> FDG.Parsers.Graphviz.to_svg("graph")
{:ok, "graph.svg"}