Dotx Elixir dot parser v0.2.0 Dotx View Source

This library is a DOT parser and generator. Main functions are encode/1 and decode/1 (usable also via to_string and the String.Chars protocol).

Some additional helper function are useful to inspect a graph and use them :

  • flatten/1 create unitary edge for every DOT shortand (inline edge a->b->c or graph edge {a b}->c)
  • spread_attributes/1 spread default attributes from graph/subgraphs to all children handling inheritance of attributes.

Link to this section Summary

Link to this section Types

Link to this type

dotnode() View Source
dotnode() :: %Dotx.Node{attrs: %{optional(id()) => id()}, id: nodeid()}

Link to this type

edge() View Source
edge() :: %Dotx.Edge{
  attrs: %{optional(id()) => id()},
  bidir: boolean(),
  from: dotnode() | subgraph(edge()),
  to: dotnode() | subgraph(edge()) | edge()
}

Link to this type

flatedge() View Source
flatedge() :: %Dotx.Edge{
  attrs: %{optional(id()) => id()},
  bidir: boolean(),
  from: dotnode(),
  to: dotnode()
}

Link to this type

graph(edgetype) View Source
graph(edgetype) :: %Dotx.Graph{
  attrs: %{optional(id()) => id()},
  children: [dotnode() | edgetype | subgraph(edgetype)],
  edges_attrs: %{optional(id()) => id()},
  graphs_attrs: %{optional(id()) => id()},
  id: nil | id(),
  nodes_attrs: %{optional(id()) => id()},
  strict: boolean(),
  type: :graph | :digraph
}

Link to this type

id() View Source
id() :: binary() | %Dotx.HTML{html: binary()}

Link to this type

subgraph(edgetype) View Source
subgraph(edgetype) :: %Dotx.SubGraph{
  attrs: %{optional(id()) => id()},
  children: [dotnode() | edgetype | subgraph(edgetype)],
  edges_attrs: %{optional(id()) => id()},
  graphs_attrs: %{optional(id()) => id()},
  id: nil | id(),
  nodes_attrs: %{optional(id()) => id()}
}

Link to this section Functions

Link to this function

decode(bin) View Source
decode(binary()) :: {:ok, graph(edge())} | {:error, msg :: binary()}

Link to this function

identify(graph) View Source
identify(graph(edge())) :: graph(edge())

Link to this function

spread_attributes(graph) View Source
spread_attributes(graph()) :: graph()

Link to this function

spread_attributes(e, graph) View Source