ChainEventGraphReducer#
- class cegpy.ChainEventGraphReducer(ceg: ChainEventGraph)[source]#
Bases:
object
Reduces Chain Event Graphs given certain and/or uncertain evidence.
- Parameters:
ceg (ChainEventGraph) – Chain event graph object to reduce.
- property certain_edges: List[Tuple[str]]#
- Returns:
A list of all edges of the ChainEventGraph that have been observed.
certain_edges is a list of edge tuples of the form: [edge_1, edge_2, … edge_n]
Each edge tuple takes the form: (“source_node_name”, “destination_node_name”, “edge_label”)
- property uncertain_edges: List[Tuple[str]]#
- Returns:
A list of sets of edges of the ChainEventGraph which might have occurred.
uncertain_edges is a list of sets of edge tuples of the form: [{(a, b, label), (a, c, label)}, {(x, y, label), (x, z, label)}]
Each edge tuple takes the form: (“source_node_name”, “destination_node_name”, “edge_label”)
- property certain_nodes: Set[str]#
- Returns:
A set of all nodes of the ChainEventGraph that have been observed.
certain_nodes is a set of nodes of the form: {“node_1”, “node_2”, “node_3”, … “node_n”}
- property uncertain_nodes: List[Set[str]]#
- Returns:
A list of sets of nodes of the ChainEventGraph where there is uncertainty which of the nodes in each set happened.
uncertain_nodes is a list of sets of nodes of the form: [{“node_1”, “node_2”}, {“node_3”, “node_4”}, …]
- property paths: List[List[Tuple[str]]]#
- Returns:
A list of all paths through the reduced ChainEventGraph.
- property graph: ChainEventGraph#
- Returns:
The reduced graph once all evidence has been taken into account.
- Return type:
- add_certain_edge(src: str, dst: str, label: str) None [source]#
Specify an edge that has been observed.
- Parameters:
src (str) – Edge source node label
dst (str) – Edge destination node label
label (str) – Label of certain edge
- remove_certain_edge(src: str, dst: str, label: str) None [source]#
Specify an edge to remove from the certain edges.
- Parameters:
src (str) – Edge source node label
dst (str) – Edge destination node label
label (str) – Label of certain edge
- add_certain_edge_list(edges: List[Tuple[str]]) None [source]#
Specify a list of edges that have all been observed.
- Parameters:
edges (List[Tuple[str]]) – List of edge tuples of the form (“src”, “dst”, “label”)
- remove_certain_edge_list(edges: List[Tuple[str]]) None [source]#
Specify a list of edges that in the certain edge list to remove.
- Parameters:
edges (List[Tuple[str]]) – List of edge tuples of the form (“src”, “dst”, “label”)
- add_uncertain_edge_set(edge_set: Set[Tuple[str]]) None [source]#
Specify a set of edges where one of the edges has occurred, but you are uncertain of which one it is.
- Parameters:
edge_set (Set[Tuple[str]]) – Set of edge tuples of the form (“src”, “dst”, “label”)
- remove_uncertain_edge_set(edge_set: Set[Tuple[str]]) None [source]#
Specify a set of edges to remove from the uncertain edges.
- Parameters:
edge_set (Set[Tuple[str]]) – Set of edge tuples of the form (“src”, “dst”, “label”)
- add_uncertain_edge_set_list(edge_sets: List[Set[Tuple[str]]]) None [source]#
Specify a list of sets of edges where one of the edges has occurred, but you are uncertain of which one it is.
- Parameters:
edge_set (List[Set[Tuple[str]]]) – List of sets of edge tuples of the form (“src”, “dst”, “label”)
- remove_uncertain_edge_set_list(edge_sets: List[Set[Tuple[str]]]) None [source]#
Specify a list of sets of edges to remove from the evidence list.
- Parameters:
edge_set (List[Set[Tuple[str]]]) – List of sets of edge tuples of the form (“src”, “dst”, “label”)
- add_certain_node(node: str) None [source]#
Specify a node in the graph that has been observed.
- Parameters:
node (str) – A node label e.g. “w4”
- remove_certain_node(node: str) None [source]#
Specify a node to be removed from the certain nodes list.
- Parameters:
node (str) – A node label e.g. “w4”
- add_certain_node_set(nodes: Set[str]) None [source]#
Specify a set of nodes that have been observed.
- Parameters:
nodes (Set[str]) – A set of node labels e.g. {“w4”, “w8”}
- remove_certain_node_set(nodes: Set[str]) None [source]#
Specify a list of nodes to remove from the list of nodes that have been observed.
- Parameters:
nodes (Set[str]) – A set of node labels e.g. {“w4”, “w8”}
- add_uncertain_node_set(node_set: Set[str]) None [source]#
Specify a set of nodes where one of the nodes has occurred, but you are uncertain of which one it is.
- Parameters:
nodes (Set[str]) – A set of node labels e.g. {“w4”, “w8”}
- remove_uncertain_node_set(node_set: Set[str]) None [source]#
Specify a set of nodes to be removed from the uncertain nodes set list.
- Parameters:
nodes (Set[str]) – A set of node labels e.g. {“w4”, “w8”}