emel v0.1.2 DataStructures.Tree View Source
Link to this section Summary
Functions
The sequences of nodes connecting the root with the leafs
Converts the %Node
into a nice, visible tree for console printing
Link to this section Functions
The sequences of nodes connecting the root with the leafs.
Examples
iex> alias DataStructures.Tree.Node
...>
...> DataStructures.Tree.paths(%Node{
...> content: "root",
...> children: [
...> %Node{
...> content: :leaf
...> },
...> %Node{
...> children: [
...> %Node{
...> content: "second_level",
...> children: [
...> %Node{
...> content: 0
...> }
...> ]
...> }]
...> }]
...> })
[["root", :leaf],
["root", nil, "second_level", 0]]
Converts the %Node
into a nice, visible tree for console printing.
Examples
iex> alias DataStructures.Tree.Node
...>
...> DataStructures.Tree.pretty(%Node{
...> content: "root",
...> children: [
...> %Node{
...> content: :leaf
...> },
...> %Node{
...> children: [
...> %Node{
...> content: "second_level",
...> children: [
...> %Node{
...> content: 0
...> }
...> ]
...> }]
...> }]
...> })
[
"root",
[
:leaf,
[
[
"second_level",
[
0
]
]
]
]
]