elasticai.creator.ir.datagraph#

Module Contents#

Classes#

Node

Edge

NodeEdgeFactory

ReadOnlyDataGraph

DataGraph

Note that the fact, that add_node and similar methods take an argument of type Node while the nodes and edges properties produce mappings over the generic type parameters E and N. This makes DataGraph covariant over N and E, meaning that DataGraph[SpecialNode, SpecialEdge] is a subtype of DataGraph[Node, Edge]. It also means that every implementation detail in a DataGraph implementation needs to assume that nodes and edges are of the most general Node or Edge type.

Data#

N

E

API#

class elasticai.creator.ir.datagraph.Node[source]#

Bases: typing.Protocol

abstract property attributes: elasticai.creator.ir.attribute.AttributeMapping#
abstract property type: str#
abstract property name: str#
abstractmethod __eq__(o: object, /) bool[source]#
class elasticai.creator.ir.datagraph.Edge[source]#

Bases: typing.Protocol

abstract property attributes: elasticai.creator.ir.attribute.AttributeMapping#
abstract property src: str#
abstract property dst: str#
abstractmethod __eq__(o: object, /) bool[source]#
elasticai.creator.ir.datagraph.N#

‘TypeVar(…)’

elasticai.creator.ir.datagraph.E#

‘TypeVar(…)’

class elasticai.creator.ir.datagraph.NodeEdgeFactory[source]#

Bases: typing.Protocol[elasticai.creator.ir.datagraph.N, elasticai.creator.ir.datagraph.E]

abstractmethod node(name: str, attributes: elasticai.creator.ir.attribute.AttributeMapping = AttributeMapping(), /) elasticai.creator.ir.datagraph.N[source]#
abstractmethod edge(src: str, dst: str, attributes: elasticai.creator.ir.attribute.AttributeMapping = AttributeMapping(), /) elasticai.creator.ir.datagraph.E[source]#
class elasticai.creator.ir.datagraph.ReadOnlyDataGraph[source]#

Bases: elasticai.creator.ir.graph.ReadOnlyGraph[str, elasticai.creator.ir.attribute.AttributeMapping], typing.Protocol[elasticai.creator.ir.datagraph.N, elasticai.creator.ir.datagraph.E]

abstract property attributes: elasticai.creator.ir.attribute.AttributeMapping#
abstract property nodes: collections.abc.Mapping[str, elasticai.creator.ir.datagraph.N]#
abstract property graph: elasticai.creator.ir.graph.Graph[str, elasticai.creator.ir.attribute.AttributeMapping]#
abstract property node_attributes: elasticai.creator.ir.attribute.AttributeMapping#
abstract property edges: collections.abc.Mapping[tuple[str, str], elasticai.creator.ir.datagraph.E]#
abstract property factory: elasticai.creator.ir.datagraph.NodeEdgeFactory[elasticai.creator.ir.datagraph.N, elasticai.creator.ir.datagraph.E]#
class elasticai.creator.ir.datagraph.DataGraph[source]#

Bases: elasticai.creator.ir.datagraph.ReadOnlyDataGraph[elasticai.creator.ir.datagraph.N, elasticai.creator.ir.datagraph.E], elasticai.creator.ir.graph.Graph[str, elasticai.creator.ir.attribute.AttributeMapping], typing.Protocol[elasticai.creator.ir.datagraph.N, elasticai.creator.ir.datagraph.E]

Note that the fact, that add_node and similar methods take an argument of type Node while the nodes and edges properties produce mappings over the generic type parameters E and N. This makes DataGraph covariant over N and E, meaning that DataGraph[SpecialNode, SpecialEdge] is a subtype of DataGraph[Node, Edge]. It also means that every implementation detail in a DataGraph implementation needs to assume that nodes and edges are of the most general Node or Edge type.

abstractmethod add_nodes(*args: elasticai.creator.ir.datagraph.Node | tuple[str, elasticai.creator.ir.attribute.AttributeMapping] | str) Self[source]#
abstractmethod add_edges(*args: elasticai.creator.ir.datagraph.Edge | tuple[str, str, elasticai.creator.ir.attribute.AttributeMapping] | tuple[str, str]) Self[source]#
abstractmethod remove_node(node: str, /) Self[source]#
abstractmethod remove_edge(src: str, dst: str) Self[source]#
abstractmethod with_attributes(attributes: elasticai.creator.ir.attribute.AttributeMapping) Self[source]#