bintreeviz v0.1.1 Bintreeviz.Node View Source

Bintreeviz.Node describes a single Node in the graph and contains the functions to manipulate said Nodes.

Link to this section Summary

Functions

is_leaf/1 returns true if the node has no left_child and no right_child.

new/1 takes a string label and returns a new %Node{}

new/2 takes a string label and an Keyword list containing left and right children and returns a new %Node{}

set_left_child/2 assigns the passed in node as the left_child to the node.

set_right_child/2 assigns the passed in node as the right_child to the node.

width/1 returns the width of the node. Width of the node is determined by the length of the label plus the configured padding for the nodes.

Link to this section Types

Link to this type

node_children()

View Source
node_children() :: [left_child: t() | nil, right_child: t() | nil]
Link to this type

t()

View Source
t() :: %Bintreeviz.Node{
  label: String.t(),
  left_child: t(),
  offset: integer(),
  right_child: t(),
  x: non_neg_integer(),
  y: non_neg_integer()
}

Link to this section Functions

Link to this function

is_leaf?(root)

View Source
is_leaf?(t()) :: boolean()

is_leaf/1 returns true if the node has no left_child and no right_child.

new/1 takes a string label and returns a new %Node{}

new/2 takes a string label and an Keyword list containing left and right children and returns a new %Node{}

Link to this function

set_left_child(self, child)

View Source
set_left_child(t(), t()) :: t()

set_left_child/2 assigns the passed in node as the left_child to the node.

Link to this function

set_right_child(self, child)

View Source
set_right_child(t(), t()) :: t()

set_right_child/2 assigns the passed in node as the right_child to the node.

width/1 returns the width of the node. Width of the node is determined by the length of the label plus the configured padding for the nodes.