View Source UnrootedPolytree.Node (UnrootedPolytree v0.1.1)

A node in an UnrootedPolytree. Contains any value, and a unique string ID.

Link to this section Summary

Functions

Constructs a Node given an ID string and any value.

Returns the ID string of this node.

Returns the value of this node.

Link to this section Types

@type id() :: String.t()
@type t() :: %UnrootedPolytree.Node{id: id(), value: any()}

Link to this section Functions

Link to this function

from_id_and_value(id, value)

View Source
@spec from_id_and_value(id(), any()) :: t()

Constructs a Node given an ID string and any value.

iex> UnrootedPolytree.Node.from_id_and_value("a", %{foo: "bar"}) %UnrootedPolytree.Node{id: "a", value: %{foo: "bar"}}

@spec id(t()) :: id()

Returns the ID string of this node.

iex> UnrootedPolytree.Node.id(%UnrootedPolytree.Node{id: "a", value: %{foo: "bar"}}) "a"

@spec value(t()) :: any()

Returns the value of this node.

iex> UnrootedPolytree.Node.value(%UnrootedPolytree.Node{id: "a", value: %{foo: "bar"}}) %{foo: "bar"}