graphvix v0.4.0 Graphvix.Edge

Graphvix.Edge provides functions for adding, updating, and deleting edges in a graph.

Summary

Functions

Deletes the edge with the provided edge_id

Find the edge in the graph that has the provided edge_id

Adds an edge to the graph

Updates the attributes for an edge with the provided edge_id

Types

node_id_or_label()
node_id_or_label :: pos_integer | String.t | atom

Functions

chain(node_chain)
delete(edge_id)
delete(pos_integer) :: :ok

Deletes the edge with the provided edge_id.

Does nothing if the edge does not exist.

iex> {e_id, e} = Edge.new(n1, n2)
iex> Edge.delete(e_id)
find(edge_id)
find(pos_integer) :: map | nil

Find the edge in the graph that has the provided edge_id.

Returns the edge, or nil if it is not found.

iex> {e_id, e} = Edge.new(n1, n2)
iex> Edge.find(e_id) #=> returns `e`
new(n1, n2, attrs \\ [])
new(node_id_or_label, node_id_or_label | [node_id_or_label], Keyword.t | nil) :: {pos_integer, map}

Adds an edge to the graph.

The edge connects the two nodes with ids matching the first two parameters, and sets its starting attributes to attrs.

iex> {n1_id, n1} = Node.new
iex> {n2_id, n2} = Node.new
iex> Edge.new(n1_id, n2_id)
{3, %{ start_node: 1, end_node: 2, attrs: [] }}
update(edge_id, attrs)
update(pos_integer, Keyword.t) :: :ok

Updates the attributes for an edge with the provided edge_id.

If nil is passed as a value in the attrs keyword list, it will remove the key entirely from the edge’s attributes.

iex> {e_id, e} = Edge.new(n1, n2, color: "blue")
iex> Edge.update(e_id, color: nil, label: "Connection")