graph¶
Graph module.
-
class
InteractionNode(type_name: str, number_of_ingoing_edges: int, number_of_outgoing_edges: int)[source]¶ Bases:
objectStruct-like definition of an interaction node.
-
class
StateTransitionGraph[source]¶ Bases:
objectGraph class that contains edges and nodes.
Similar to feynman graphs. The graphs are directed, meaning the edges are ingoing and outgoing to specific nodes (since feynman graphs also have a time axis) This class can contain the full information of a state transition from a initial state to a final state. This information can be attached to the nodes and edges via properties.
-
add_node(node_id: int) → None[source]¶ Adds a node with id node_id.
- Raises
ValueError – if node_id already exists
-
attach_edges_to_node_ingoing(ingoing_edge_ids: Sequence[int], node_id: int) → None[source]¶ Attach existing edges to nodes.
So that the are ingoing to these nodes.
- Parameters
- Raises
ValueError – if an edge not doesn’t exist.
ValueError – if an edge ID is already an ingoing node.
-
-
are_graphs_isomorphic(graph1: expertsystem.topology.graph.StateTransitionGraph, graph2: expertsystem.topology.graph.StateTransitionGraph) → bool[source]¶ Check if two graphs are isomorphic.
- Returns
True if the two graphs have a one-to-one mapping of the node IDs and edge IDs.
- Return type
-
get_edges_ingoing_to_node(graph: expertsystem.topology.graph.StateTransitionGraph, node_id: Optional[int]) → List[int][source]¶
-
get_edges_outgoing_to_node(graph: expertsystem.topology.graph.StateTransitionGraph, node_id: Optional[int]) → List[int][source]¶
-
get_initial_state_edges(graph: expertsystem.topology.graph.StateTransitionGraph) → List[int][source]¶
-
get_intermediate_state_edges(graph: expertsystem.topology.graph.StateTransitionGraph) → List[int][source]¶