elasticai.creator.graph.base_graph#

Module Contents#

Classes#

BaseGraph

All iterators in this class are guaranteed to have a fixed order. That means, the order of iteration is only allowed to change when the data Tucture is altered. If the content of two GraphDelegates is the same and they were built in the same way, then their iteration order is the same as well.

Data#

T

API#

elasticai.creator.graph.base_graph.T#

‘TypeVar(…)’

class elasticai.creator.graph.base_graph.BaseGraph[source]#

Bases: elasticai.creator.graph.graph.Graph[elasticai.creator.graph.base_graph.T]

All iterators in this class are guaranteed to have a fixed order. That means, the order of iteration is only allowed to change when the data Tucture is altered. If the content of two GraphDelegates is the same and they were built in the same way, then their iteration order is the same as well.

Caution

This class is not thread-safe.

Note

We are not providing methods for removal of nodes or edges on purpose. If you need to remove nodes or edges, you should create a new GraphDelegate. Manipulation of the graph should usually be done in a dedicated build phase.

Initialization

We keep successor and predecessor nodes just to allow for easier implementation. Currently, this implementation is not optimized for performance.

property successors: collections.abc.Mapping[elasticai.creator.graph.base_graph.T, set[elasticai.creator.graph.base_graph.T]]#
property predecessors: collections.abc.Mapping[elasticai.creator.graph.base_graph.T, set[elasticai.creator.graph.base_graph.T]]#
static from_dict(d: dict[elasticai.creator.graph.base_graph.T, collections.abc.Iterable[elasticai.creator.graph.base_graph.T]])[source]#
as_dict() dict[elasticai.creator.graph.base_graph.T, set[elasticai.creator.graph.base_graph.T]][source]#
add_edge(_from: elasticai.creator.graph.base_graph.T, _to: elasticai.creator.graph.base_graph.T) Self[source]#
add_node(node: elasticai.creator.graph.base_graph.T) Self[source]#
property nodes: collections.abc.Set[elasticai.creator.graph.base_graph.T]#
iter_nodes() collections.abc.Iterator[elasticai.creator.graph.base_graph.T][source]#

Iterator over nodes in a fixed but unspecified order.

iter_edges() collections.abc.Iterator[tuple[elasticai.creator.graph.base_graph.T, elasticai.creator.graph.base_graph.T]][source]#

Iterator over edges in a fixed but unspecified order.

get_edges() collections.abc.Iterator[tuple[elasticai.creator.graph.base_graph.T, elasticai.creator.graph.base_graph.T]][source]#

Iterator over edges in a fixed but unspecified order.

get_successors(node: elasticai.creator.graph.base_graph.T) collections.abc.Iterator[elasticai.creator.graph.base_graph.T][source]#

Iterator over node successors in a fixed but unspecified order.

get_predecessors(node: elasticai.creator.graph.base_graph.T) collections.abc.Iterator[elasticai.creator.graph.base_graph.T][source]#

Iterator over node predecessors in a fixed but unspecified order.

new() Self[source]#
copy() Self[source]#