OrderedNaryTree (ordered_nary_tree v0.0.4)
A struct based implementation of a pure Elixir ordered n-ary tree
Link to this section Summary
Link to this section Types
@type t() :: %OrderedNaryTree{root: tree_node() | nil}
Link to this type
tree_node()
@type tree_node() :: OrderedNaryTree.Node.t()
Link to this type
tree_node_id()
@type tree_node_id() :: OrderedNaryTree.Node.id()
Link to this section Functions
Link to this function
add_child(tree, child_node)
Link to this function
add_child(tree, parent_node_id, child_node)
@spec add_child(t(), tree_node_id(), tree_node()) :: {:ok, t()} | {:error, :empty_root | :not_found}
Link to this function
children(tree)
Link to this function
children(tree, node_id)
@spec children(t(), tree_node_id()) :: {:ok, [tree_node()]} | {:error, :empty_root | :not_found}
Link to this function
find(tree, func)
Link to this function
new(root \\ nil)
Link to this function
parent(tree, node_id)
@spec parent(t(), tree_node_id()) :: {:ok, tree_node()} | {:error, :empty_root | :not_found}
Link to this function