View Source Convert DOT to SVG
Mix.install([
{:libgraph, "~> 0.16.0"},
{:kino, "~> 0.12.3"},
{:ex_dot, "~> 0.1.0"}
# {:ex_dot, github: "chgeuer/ex_dot"}
# {:ex_dot, path: "/github/chgeuer/ex_dot"},
# {:rustler, "~> 0.31.0"}
])
Render a DOT graph
This demo uses the https://crates.io/crates/layout-rs crate (src: https://github.com/nadavrot/layout), wraps it using Rustler, and allows to convert text in DOT Language to SVG.
"""
digraph R {
node [shape=record];
{ rank=same rA sA tA }
{ rank=same uB vB wB }
rA -> sA;
sA -> vB;
t -> rA;
uB -> vB;
wB -> u;
wB -> tA;
}
"""
|> Dot.to_svg()
|> Kino.Image.new(:svg)