pywhy_graphs.algorithms.compute_invariant_domains_per_node#
- pywhy_graphs.algorithms.compute_invariant_domains_per_node(G: AugmentedGraph, node: int | float | str | Any, all_poss_snodes: Set | None = None, n_domains: int | None = 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:
- GAugmentedGraph
The augmented graph.
- nodeNode
The node in G to compute the invariant domains for.
- all_poss_snodesOptional[Set], optional
All possible S-nodes, by default None. If None, will infer based on the number of domains.
- n_domainsint, optional
The number of domains, by default None. If None, will infer based on the
domain_ids
attribute of G.- inconsistencystr, 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:
- GAugmentedGraph
The augmented graph