Radix.dot

You're seeing just the function dot, go back to Radix module for more information.

Specs

dot(tree(), keyword()) :: [String.t()]

Returns a list of lines describing the tree as a graphviz digraph.

Options include:

  • :label, defaults to "radix")
  • :labelloc, defaults to "t"
  • :rankdir, defaults to "TB"
  • :ranksep, defaults to "0.5 equally"
  • :rootcolor, defaults to "orange"
  • :nodecolor, defaults to "yellow"
  • :leafcolor, defaults to "green"
  • :kv_tostr, defaults to an internal function that converts key to dotted decimal string (cidr style)

If supplied via :kv_tostr, the function's signature must be ({key/0, value/0}) :: String.t/0 and where the resulting string must be HTML-escaped. See html-entities.

Works best for smaller trees.

Example

iex> t = new()
...> |> put(<<0, 0>>, "left")
...> |> put(<<1, 1, 1::1>>, "left")
...> |> put(<<128, 0>>, "right")
iex> g = dot(t, label: "example")
iex> File.write("assets/example.dot", g)
:ok

which, after converting with dot, yields the following image:

example