pywhy_graphs.algorithms.compute_invariant_domains_per_node#

pywhy_graphs.algorithms.compute_invariant_domains_per_node(G: AugmentedGraph, node: Union[int, float, str, Any], all_poss_snodes: Optional[Set] = None, n_domains: Optional[int] = None, inconsistency='raise')[source]#

Compute the invariant domains for a specific node.

This proceeds by constructing all possible S-nodes given the number of domains (i.e. n_domains choose 2 S-nodes), and then uses the S-nodes in G to infer the invariant domains for the node.

Parameters:

G : AugmentedGraph

The augmented graph.

node : Node

The node in G to compute the invariant domains for.

all_poss_snodes : Optional[Set], optional

All possible S-nodes, by default None. If None, will infer based on the number of domains.

n_domains : int, optional

The number of domains, by default None. If None, will infer based on the domain_ids attribute of G.

inconsistency : str, optional

How to handle inconsistencies, by default ‘raise’. Can be one of: - ‘raise’: raise an exception - ‘ignore’: ignore the inconsistency. - ‘warn’: raise a warning

An inconsistency is when the current included S-nodes are not the same after computing the invariant domains. If ‘ignore’, or ‘warn’, the inconsistent S-node will be removed in G.

Returns:

G : AugmentedGraph

The augmented graph