graphvix v0.0.1 Graphvix
Summary
Functions
Adds a chain of nodes with connecting edges to the graph
Adds a new edge between two nodes, creating the nodes if necessary
Adds a node, if it doesn’t exist
Starts a new process for managing a digraph
Returns the contents of the graph
Updates settings for an existing edge
Update a node’s settings
Writes the graph in .dot
format
Writes the graph in .dot
format to a file
Functions
Adds a chain of nodes with connecting edges to the graph
Examples
iex> {:ok, graph} = Graphvix.new
iex> Graphvix.add_chain(graph, [:start, :middle, :end])
iex> g = Graphvix.show(graph)
iex> g.nodes |> Enum.count
3
iex> g.edges |> Enum.count
2
Adds a new edge between two nodes, creating the nodes if necessary
Examples
iex> {:ok, graph} = Graphvix.new
iex> Graphvix.add_node(graph, :start)
iex> Graphvix.add_edge(graph, :start, :end)
iex> Graphvix.show(graph)
%{
edges: %{
start: %{end: []}
},
nodes: %{
start: [label: "start"],
end: [label: "end"]
}
}
Adds a node, if it doesn’t exist
Examples
iex> {:ok, graph} = Graphvix.new
iex> Graphvix.add_node(graph, :start)
iex> Graphvix.show(graph)
%{nodes: %{start: [label: "start"]}, edges: %{}}
Starts a new process for managing a digraph
Examples
iex> {:ok, graph} = Graphvix.new
iex> is_pid(graph)
true
Returns the contents of the graph
Examples
iex> {:ok, graph} = Graphvix.new
iex> Graphvix.show(graph)
%{nodes: %{}, edges: %{}}
Updates settings for an existing edge
Examples
iex> {:ok, graph} = Graphvix.new
iex> Graphvix.add_edge(graph, :start, :end)
iex> Graphvix.update_edge(graph, :start, :end, color: "red")
iex> g = Graphvix.show(graph)
iex> g.edges
%{
start: %{
end: [color: "red"]
}
}
Update a node’s settings
Examples
iex> {:ok, graph} = Graphvix.new
iex> Graphvix.add_node(graph, :start)
iex> Graphvix.update_node(graph, :start, color: "red")
iex> Graphvix.show(graph)
%{nodes: %{start: [label: "start", color: "red"]}, edges: %{}}