graphvix v0.4.0 Graphvix.Cluster
Graphvix.Cluster provides functions for adding, updating, and deleting clusters in a graph.
Summary
Functions
Adds a node or nodes to an existing cluster
Deletes the cluster with the provided cluster_id
Find the cluster in the graph that has the provided cluster_id
Create a new cluster
Removes a node or nodes from an existing cluster
Types
Functions
Adds a node or nodes to an existing cluster.
iex> {c_id, c} = Cluster.new
iex> {n_id, n} = Node.new
iex> {n2_id, n2} = Node.new
# Adding a single node
iex> Cluster.add(c_id, n_id)
# Adding multiple nodes
iex> Cluster.add(c_id, [n_id, n2_id])
Deletes the cluster with the provided cluster_id.
iex> {c_id, c} = Cluster.new
iex> Cluster.delete(c_id)
Find the cluster in the graph that has the provided cluster_id.
Returns the cluster, or nil if it is not found.
iex> {c_id, c} = Cluster.new
iex> Cluster.find(c_id) #=> returns `c`
Create a new cluster.
The cluster is empty by default, but can be provided with nodes
already part of it.
iex> {n_id, n} = Node.new
iex> {n2_id, n2} = Node.new
# Passing no node ids
iex> Cluster.new
{3, %{ node_ids: [] }
# Passing a single node id
iex> Cluster.new(n_id)
{3, %{ node_ids: [1] }
# Passing multiple node ids
iex> Cluster.new([n_id, n2_id])
{3, %{ node_ids: [1, 2] }
Removes a node or nodes from an existing cluster.
iex> {n_id, n} = Node.new
iex> {n2_id, n2} = Node.new
iex> {c_id, c} = Cluster.new([n_id, n2_id])
# Removing a single node
iex> Cluster.remove(c_id, n_id)
# Removing multiple nodes
iex> Cluster.remove(c_id, [n_id, n2_id])