An n-ary tree by any other name…
A rose tree is an n-ary tree in which each node has zero or more children, all of which are themselves rose trees.
Up-to-date documentation can be found on hex.
RoseTree.new/0RoseTree.new/1RoseTree.new/2RoseTree.from_map/1
RoseTree.add_child/2RoseTree.add_child/2RoseTree.pop_child/1RoseTree.pop_child_at/2RoseTree.elem_at/2
RoseTree.map/2RoseTree.update_node/3RoseTree.update_children/3RoseTree.merge_nodes/2
RoseTree.to_list/1RoseTree.paths/1RoseTree.child_values/1
RoseTree.is_child?/2
RoseTree.Zipper.to_tree/1RoseTree.Zipper.from_tree/1
RoseTree.Zipper.nth_child/2RoseTree.Zipper.ascend/1RoseTree.Zipper.to_root/1RoseTree.Zipper.next_sibling/1RoseTree.Zipper.previous_sibling/1RoseTree.Zipper.last_child/1RoseTree.Zipper.first_child/1RoseTree.Zipper.find_child/2
RoseTree.Zipper.prune/1RoseTree.Zipper.modify/2RoseTree.Zipper.lift/2RoseTree.Zipper.insert_left/2RoseTree.Zipper.insert_right/2RoseTree.Zipper.insert_first_child/2RoseTree.Zipper.insert_last_child/2RoseTree.Zipper.insert_nth_child/3
RoseTree.Zipper.root?/1RoseTree.Zipper.leaf?/1RoseTree.Zipper.first?/1RoseTree.Zipper.last?/1RoseTree.Zipper.only_child?/1RoseTree.Zipper.has_parent?/1RoseTree.Zipper.has_children?/1
RoseTree implements the Enumerable protocol, so all applicable Enum and Stream functions are usable with a RoseTree.
Add rose_tree to your list of dependencies in mix.exs:
def deps do
[{:rose_tree, "~> 0.2.0"}]
end