graphvix v0.3.0 Graphvix.Edge

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 connecting node1 and node2

Updates the attributes for an edge with the provided edge_id

Types

node_or_id()
node_or_id :: map | pos_integer

Functions

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 = 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 = Edge.new(n1, n2)
iex> Edge.find(e.id) #=> returns `e`
new(node1, node2, attrs \\ [])
new(node_or_id, node_or_id, Keyword.t | nil) :: map

Adds an edge to the graph connecting node1 and node2.

The edge sets its starting attributes to attrs.

Edges can be created by passing node ids or nodes themselves.

iex> n1 = Node.new
iex> n2 = Node.new
iex> n3 = Node.new
iex> Edge.new(n1.id, n2.id) # or
iex> Edge.new(n2, n3)
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 = Edge.new(n1, n2, color: "blue")
iex> Edge.update(e.id, color: nil, label: "Connection")