View Source UnrootedPolytree (UnrootedPolytree v0.1.0)
A data type and related functions to support an unrooted (multiple starting nodes) polytree (a tree-like graph with edges).
Link to this section Summary
Functions
Construct an UnrootedPolytree from a list of values and associated ID strings
Construct an UnrootedPolytree from a list of lists of values and associated ID strings
Link to this section Types
@type edges_by_id() :: %{ required(UnrootedPolytree.Node.id()) => UnrootedPolytree.Edges.t() }
@type id_and_value() :: {UnrootedPolytree.Node.id(), any()}
@type nodes_by_id() :: %{ required(UnrootedPolytree.Node.id()) => UnrootedPolytree.Node.t() }
@type t() :: %UnrootedPolytree{ by_id: nodes_by_id(), edges: edges_by_id(), starting_nodes: [UnrootedPolytree.Node.id()] }
Link to this section Functions
@spec edges_for_id(t(), UnrootedPolytree.Node.id()) :: UnrootedPolytree.Edges.t()
@spec from_list([id_and_value()]) :: t()
Construct an UnrootedPolytree from a list of values and associated ID strings
@spec from_lists([[id_and_value()]]) :: t()
Construct an UnrootedPolytree from a list of lists of values and associated ID strings
@spec node_for_id(t(), UnrootedPolytree.Node.id()) :: {:ok, UnrootedPolytree.Node.t()} | :error