graph

Deprecated since version 0.1.3: Use QRules, AmpForm, and TensorWaves instead.

import pycompwa.expertsystem.topology.graph

graph module - some description here.

class Edge[source]

Bases: object

struct-like definition of an edge.

__eq__(other)[source]

defines the equal operator for the graph class.

class InteractionNode(type_name, number_of_ingoing_edges, number_of_outgoing_edges)[source]

Bases: object

struct-like definition of an interaction node.

class StateTransitionGraph[source]

Bases: object

Graph class which 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.

__eq__(other)[source]

defines the equal operator for the graph class.

add_edges(edge_ids)[source]

Adds edges with the ids in the edge_ids list.

add_node(node_id)[source]

Adds a node with id node_id.

Raises an value error, if node_id already exists

attach_edges_to_node_ingoing(ingoing_edge_ids, node_id)[source]

Attaches existing edges to nodes, so that the are ingoing to these nodes.

Parameters
  • ingoing_edge_ids ([int]) – list of edge ids, that will be attached

  • node_id (int) – id of the node to which the edges will be attached

Raises

ValueError

attach_edges_to_node_outgoing(outgoing_edge_ids, node_id)[source]
get_originating_node_list(edge_ids)[source]

Get list of node ids from which the supplied edges originate from.

Parameters

edge_ids ([int]) – list of edge ids for which the origin node is searched for

Returns

a list of node ids

Return type

[int]

set_graph_element_properties_comparator(comparator)[source]
swap_edges(edge_id1, edge_id2)[source]
verify()[source]

Verify the graph is connected, so no dangling parts which are not connected.

are_graphs_isomorphic(graph1, graph2)[source]

Returns True if the two graphs have a one-to-one mapping of the node IDs and edge IDs.

dicts_unequal(dict1, dict2)[source]
get_edges_ingoing_to_node(graph, node_id)[source]
get_edges_outgoing_to_node(graph, node_id)[source]
get_final_state_edges(graph)[source]
get_initial_state_edges(graph)[source]
get_intermediate_state_edges(graph)[source]
get_originating_final_state_edges(graph, node_id)[source]
get_originating_initial_state_edges(graph, node_id)[source]