NaryTree v0.1.1 NaryTree.Node View Source

## NaryTree.Node

NaryTree.Node encapsulates functions for creating a node in nary_tree.

Each node is assigned a random ID to be used as index in the tree

Link to this section Summary

Functions

Create a new, empty node

Create a new, empty node with name

Create a new, empty node with name and content

Link to this section Types

Link to this type t() View Source
t() :: %NaryTree.Node{
  children: [],
  content: any(),
  id: String.t(),
  level: term(),
  name: String.t(),
  parent: String.t()
}

Link to this section Functions

Create a new, empty node.

Create a new, empty node with name.

Example

iex> %NaryTree.Node{name: name, level: 0, children: []} = NaryTree.Node.new("Node")
iex> name
"Node"

Create a new, empty node with name and content.

Example

iex> %NaryTree.Node{name: name, content: content, level: 0, children: []} = NaryTree.Node.new("Root", %{w: 100})
iex> name
"Root"
iex> content
%{w: 100}