InductiveGraph.Internal (InductiveGraph v0.1.0) View Source
Functions to manage internal representation of inductive graph.
Link to this section Summary
Construction Functions
Adds edge_values
with neighbor
to adjacents
.
Adds edge_values
with neighbor
to either predecessor or successor
adjacents position
in context
.
Creates an empty graph.
Inserts tagged_edge
into graph
.
Inserts tagged_edges
into graph
.
Inserts tagged_vertex
into graph
.
Inserts tagged_vertices
into graph
.
Creates a graph from tagged_vertices
and tagged_edges
.
Merges context
into graph
.
Creates a new context based on vertex_value
.
Destruction Functions
Decomposes graph
into the context containing vertex
and the remaining
graph.
Removes edges with neighbor
from either predecessor or successor adjacents
position
in contexts of vertices
.
Removes edges with neighbor
from either predecessor or successor
adjacents position
in context
.
Update Functions
Applies function
to adjacents
.
Applies function
to every edge value in graph
.
Applies function
to every context in graph
.
Applies function
to every vertex value in graph
.
Applies vertex_function
to every vertex value and edge_function
to every
edge value in graph
.
Updates context
by function
based on update_type
.
Conversion Functions
Converts adjacents
to [{edge_value, neighbor}]
.
Converts context
to {[{edge_value, neighbor}], vertex, vertex_value, [{edge_value, neighbor}]}
.
Converts [{edge_value, neighbor}]
to adjacents
.
Converts {[{edge_value, neighbor}], vertex, vertex_value, [{edge_value, neighbor}]}
to context.
Inspection Functions
Counts number of vertices in graph
.
Determines if graph
is empty.
Determines if edge
is in graph
.
Determines if vertex
is in graph
.
Lists all tagged edges in graph
.
Lists all vertices in graph
.
Pretty prints inductive representation of graph
.
Gets range of vertex in graph
.
Link to this section Types
Specs
adjacents() :: %{required(neighbor()) => [edge_value()]}
Specs
context() :: {predecessors(), vertex_value(), successors()}
Specs
edge() :: InductiveGraph.edge()
Specs
edge_value() :: InductiveGraph.edge_value()
Specs
neighbor() :: InductiveGraph.neighbor()
Specs
predecessors() :: adjacents()
Specs
successors() :: adjacents()
Specs
Specs
tagged_edge() :: InductiveGraph.tagged_edge()
Specs
tagged_vertex() :: InductiveGraph.tagged_vertex()
Specs
value() :: InductiveGraph.value()
Specs
vertex() :: InductiveGraph.vertex()
Specs
vertex_value() :: InductiveGraph.vertex_value()
Link to this section Construction Functions
Specs
add_edges_to_adjacents(adjacents(), neighbor(), [edge_value()]) :: adjacents()
Adds edge_values
with neighbor
to adjacents
.
Specs
add_edges_to_context( context(), neighbor(), [edge_value()], :predecessors | :successors ) :: context()
Adds edge_values
with neighbor
to either predecessor or successor
adjacents position
in context
.
Specs
empty_graph() :: t()
Creates an empty graph.
Specs
insert_tagged_edge(t(), tagged_edge()) :: {:ok, t()} | :error
Inserts tagged_edge
into graph
.
Specs
insert_tagged_edges(t(), [tagged_edge()]) :: {:ok, t()} | :error
Inserts tagged_edges
into graph
.
Specs
insert_tagged_vertex(t(), tagged_vertex()) :: {:ok, t()} | :error
Inserts tagged_vertex
into graph
.
Specs
insert_tagged_vertices(t(), [tagged_vertex()]) :: {:ok, t()} | :error
Inserts tagged_vertices
into graph
.
Specs
make_graph([tagged_vertex()], [tagged_edge()]) :: {:ok, t()} | :error
Creates a graph from tagged_vertices
and tagged_edges
.
Specs
merge(t(), InductiveGraph.context()) :: {:ok, t()} | :error
Merges context
into graph
.
Specs
new_context(vertex_value()) :: context()
Creates a new context based on vertex_value
.
Link to this section Destruction Functions
Specs
decompose(t(), vertex()) :: {:ok, InductiveGraph.context(), t()} | :error
Decomposes graph
into the context containing vertex
and the remaining
graph.
Specs
Removes edges with neighbor
from either predecessor or successor adjacents
position
in contexts of vertices
.
Specs
Removes edges with neighbor
from either predecessor or successor
adjacents position
in context
.
Link to this section Update Functions
Specs
Applies function
to adjacents
.
Specs
map_edges(t(), (edge_value() -> edge_value())) :: t()
Applies function
to every edge value in graph
.
Specs
map_graph(t(), (InductiveGraph.context() -> InductiveGraph.context())) :: t()
Applies function
to every context in graph
.
Specs
map_vertices(t(), (vertex_value() -> vertex_value())) :: t()
Applies function
to every vertex value in graph
.
Specs
map_vertices_and_edges( t(), (vertex_value() -> vertex_value()), (edge_value() -> edge_value()) ) :: t()
Applies vertex_function
to every vertex value and edge_function
to every
edge value in graph
.
Specs
update_context( context(), :context | :predecessors | :vertex_value | :successors, (context() -> context()) | (adjacents() -> adjacents()) | (value() -> value()) ) :: context()
Updates context
by function
based on update_type
.
Link to this section Conversion Functions
Specs
from_adjacents(adjacents()) :: InductiveGraph.adjacents()
Converts adjacents
to [{edge_value, neighbor}]
.
Specs
from_context(context(), vertex()) :: InductiveGraph.context()
Converts context
to {[{edge_value, neighbor}], vertex, vertex_value, [{edge_value, neighbor}]}
.
Specs
to_adjacents(InductiveGraph.adjacents()) :: adjacents()
Converts [{edge_value, neighbor}]
to adjacents
.
Specs
to_context(InductiveGraph.context()) :: context()
Converts {[{edge_value, neighbor}], vertex, vertex_value, [{edge_value, neighbor}]}
to context.
Link to this section Inspection Functions
Specs
count_vertices(t()) :: non_neg_integer()
Counts number of vertices in graph
.
Specs
Determines if graph
is empty.
Specs
Determines if edge
is in graph
.
Specs
Determines if vertex
is in graph
.
Specs
list_tagged_edges(t()) :: [tagged_edge()]
Lists all tagged edges in graph
.
Specs
list_tagged_vertices(t()) :: [tagged_vertex()]
Lists all vertices in graph
.
Specs
Pretty prints inductive representation of graph
.
If count
is provided, then up to count
number of contexts will be shown.
Specs
Gets range of vertex in graph
.
Returns {:ok, minimum, maximum}
for graphs with at least one vertex. Returns
:error
for empty graph.