![]() |
aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
|
Implements Backdoor and Frontdoor criteria utilities for a DAG. More...
#include <doorCriteria.h>
Public Types | |
| using | NodeSetVec = std::vector< NodeSet > |
| Convenience type: list of candidate adjustment sets. | |
Static Public Member Functions | |
| static bool | satisfiesBackdoorCriterion (const DAG &dag, NodeId X, NodeId Y, const NodeSet &Z) |
| Check if Z satisfies the backdoor criterion relative to (X, Y). | |
| static NodeSetVec | enumerateBackdoorSets (const DAG &dag, NodeId X, NodeId Y, const NodeSet &excluded_nodes=NodeSet(), std::size_t max_cardinality=0, bool only_minimal=true, bool stopAtFirst=false) |
| Enumerate valid backdoor adjustment sets. | |
| static NodeSetVec | enumerateBackdoorSets (const DAG &dag, NodeId X, NodeId Y, bool stopAtFirst) |
| Enumerate valid backdoor adjustment sets — shorthand to set stopAtFirst only. | |
| static std::optional< NodeSet > | firstBackdoor (const DAG &dag, NodeId X, NodeId Y, const NodeSet &excluded_nodes=NodeSet(), std::size_t max_cardinality=0, bool only_minimal=true) |
| Directly return the first backdoor adjustment set if any. | |
| static bool | satisfiesFrontdoorCriterion (const DAG &dag, NodeId X, NodeId Y, const NodeSet &Z) |
| Check if Z satisfies the frontdoor criterion relative to (X, Y). | |
| static NodeSetVec | enumerateFrontdoorSets (const DAG &dag, NodeId X, NodeId Y, const NodeSet &excluded_nodes=NodeSet(), std::size_t max_cardinality=0, bool only_minimal=true, bool stopAtFirst=false) |
| Enumerate valid frontdoor adjustment sets. | |
| static NodeSetVec | enumerateFrontdoorSets (const DAG &dag, NodeId X, NodeId Y, bool stopAtFirst) |
| Enumerate valid frontdoor adjustment sets — shorthand to set stopAtFirst only. | |
| static std::optional< NodeSet > | firstFrontdoor (const DAG &dag, NodeId X, NodeId Y, const NodeSet &excluded_nodes=NodeSet(), std::size_t max_cardinality=0, bool only_minimal=true) |
| Directly return the first frontdoor adjustment set if any. | |
| static bool | existsUnblockedDirectedPath (const DAG &dag, NodeId X, NodeId Y, const NodeSet &Z) |
| Check whether there exists a directed path X->..->Y unblocked by Z. | |
| static std::optional< NodeSet > | nodesOnDirectedPaths (const DAG &dag, NodeId X, NodeId Y) |
| Compute nodes lying on some directed path from X to Y. | |
| static NodeSet | backdoorReach (const DAG &dag, NodeId X) |
| Compute the "backdoor reach" of a node. | |
| static bool | hasBackdoorPath (const DAG &dag, NodeId X, NodeId Y, const NodeSet &Z) |
| Test whether there exists an open backdoor path from X to Y given Z. | |
Static Private Member Functions | |
| static bool | _isMinimalBackdoorAdjustment (const DAG &dag, NodeId X, NodeId Y, const NodeSet &Z) |
| Check whether Z is a minimal backdoor adjustment set. | |
| static bool | _isMinimalFrontdoorAdjustment (const DAG &dag, NodeId X, NodeId Y, const NodeSet &Z) |
| Check whether Z is a minimal frontdoor adjustment set. | |
| static bool | _existsUnblockedDirectedPath_ (const DAG &dag, NodeId X, NodeId Y, const NodeSet &Z, NodeSet &visited) |
Implements Backdoor and Frontdoor criteria utilities for a DAG.
This class provides helpers to:
The DAG is passed as the first argument to each method rather than stored in the object, making DoorCriteria a stateless utility class.
The implementation mirrors pyAgrum functionality.
Naming correspondences with pyAgrum:
Definition at line 79 of file doorCriteria.h.
| using gum::DoorCriteria::NodeSetVec = std::vector< NodeSet > |
Convenience type: list of candidate adjustment sets.
Definition at line 82 of file doorCriteria.h.
|
staticprivate |
Definition at line 421 of file doorCriteria.cpp.
References _existsUnblockedDirectedPath_(), gum::ArcGraphPart::children(), gum::Set< Key >::contains(), gum::ArcGraphPart::existsArc(), and gum::Set< Key >::insert().
Referenced by _existsUnblockedDirectedPath_(), and existsUnblockedDirectedPath().
|
staticprivate |
Check whether Z is a minimal backdoor adjustment set.
| dag | Directed acyclic graph representing the causal structure. |
| X | Cause variable. |
| Y | Effect variable. |
| Z | Candidate conditioning set. |
Definition at line 514 of file doorCriteria.cpp.
References gum::Set< Key >::erase(), and satisfiesBackdoorCriterion().
|
staticprivate |
Check whether Z is a minimal frontdoor adjustment set.
| dag | Directed acyclic graph representing the causal structure. |
| X | Cause variable. |
| Y | Effect variable. |
| Z | Candidate conditioning set. |
Definition at line 526 of file doorCriteria.cpp.
References gum::Set< Key >::empty(), gum::Set< Key >::erase(), and satisfiesFrontdoorCriterion().
Referenced by enumerateFrontdoorSets().
Compute the "backdoor reach" of a node.
Backdoor reach = set of nodes reachable from X by traversing one incoming edge (parent step) followed by any sequence of child steps.
| dag | Directed acyclic graph representing the causal structure. |
| X | Node of interest (typically the treatment). |
Definition at line 480 of file doorCriteria.cpp.
References gum::Set< Key >::erase(), gum::Set< Key >::insert(), and gum::ArcGraphPart::parents().
Referenced by enumerateFrontdoorSets(), and satisfiesFrontdoorCriterion().
|
static |
Enumerate valid backdoor adjustment sets — shorthand to set stopAtFirst only.
| dag | Directed acyclic graph representing the causal structure. |
| X | Cause variable. |
| Y | Effect variable. |
| stopAtFirst | If true, return only the first found set and stop early. |
Definition at line 274 of file doorCriteria.cpp.
References enumerateBackdoorSets().
|
static |
Enumerate valid backdoor adjustment sets.
| dag | Directed acyclic graph representing the causal structure. |
| X | Cause variable. |
| Y | Effect variable. |
| excluded_nodes | Nodes to exclude from candidate sets (e.g., latent variables). |
| max_cardinality | Maximum set size (0 = no limit). |
| only_minimal | If true, return only minimal adjustment sets. |
| stopAtFirst | If true, return only the first found set and stop early. |
Definition at line 166 of file doorCriteria.cpp.
References gum::Set< Key >::contains(), gum::DiGraph::descendants(), gum::Set< Key >::empty(), gum::ArcGraphPart::existsArc(), gum::Set< Key >::insert(), gum::Separation::isBackdoorSeparated(), gum::NodeGraphPart::nodes(), gum::ArcGraphPart::parents(), and gum::Separation::reduceForDSeparation().
Referenced by gum::CausalModel< GUM_SCALAR >::backDoor(), enumerateBackdoorSets(), and firstBackdoor().
|
static |
Enumerate valid frontdoor adjustment sets — shorthand to set stopAtFirst only.
| dag | Directed acyclic graph representing the causal structure. |
| X | Cause variable. |
| Y | Effect variable. |
| stopAtFirst | If true, return only the first found set and stop early. |
Definition at line 407 of file doorCriteria.cpp.
References enumerateFrontdoorSets().
|
static |
Enumerate valid frontdoor adjustment sets.
| dag | Directed acyclic graph representing the causal structure. |
| X | Cause variable. |
| Y | Effect variable. |
| excluded_nodes | Nodes to exclude from candidate sets (e.g., latent variables). |
| max_cardinality | Maximum set size (0 = no limit). |
| only_minimal | If true, return only minimal adjustment sets. |
| stopAtFirst | If true, return only the first found set and stop early. |
Definition at line 278 of file doorCriteria.cpp.
References _isMinimalFrontdoorAdjustment(), backdoorReach(), gum::ArcGraphPart::children(), gum::Set< Key >::contains(), gum::Set< Key >::empty(), gum::Set< Key >::erase(), existsUnblockedDirectedPath(), gum::Set< Key >::insert(), gum::Separation::isBackdoorSeparated(), nodesOnDirectedPaths(), gum::ArcGraphPart::parents(), and gum::Separation::reduceForDSeparation().
Referenced by enumerateFrontdoorSets(), firstFrontdoor(), and gum::CausalModel< GUM_SCALAR >::frontDoor().
|
static |
Check whether there exists a directed path X->..->Y unblocked by Z.
| dag | Directed acyclic graph representing the causal structure. |
| X | Start node. |
| Y | End node. |
| Z | Conditioning set (nodes that block traversal if encountered). |
Definition at line 413 of file doorCriteria.cpp.
References _existsUnblockedDirectedPath_().
Referenced by enumerateFrontdoorSets(), and satisfiesFrontdoorCriterion().
|
static |
Directly return the first backdoor adjustment set if any.
| dag | Directed acyclic graph representing the causal structure. |
| X | Cause variable. |
| Y | Effect variable. |
| excluded_nodes | Nodes to exclude from candidate sets (e.g., latent variables). |
| max_cardinality | Maximum set size (0 = no limit). |
| only_minimal | If true, return only minimal adjustment sets. |
Definition at line 48 of file doorCriteria_inl.h.
References enumerateBackdoorSets().
|
static |
Directly return the first frontdoor adjustment set if any.
| dag | Directed acyclic graph representing the causal structure. |
| X | Cause variable. |
| Y | Effect variable. |
| excluded_nodes | Nodes to exclude from candidate sets (e.g., latent variables). |
| max_cardinality | Maximum set size (0 = no limit). |
| only_minimal | If true, return only minimal adjustment sets. |
Definition at line 60 of file doorCriteria_inl.h.
References enumerateFrontdoorSets().
|
static |
Test whether there exists an open backdoor path from X to Y given Z.
| dag | Directed acyclic graph representing the causal structure. |
| X | Cause variable. |
| Y | Effect variable. |
| Z | Conditioning set. |
Definition at line 504 of file doorCriteria.cpp.
References gum::Set< Key >::insert(), and gum::Separation::isBackdoorSeparated().
|
static |
Compute nodes lying on some directed path from X to Y.
| dag | Directed acyclic graph representing the causal structure. |
| X | Start node. |
| Y | End node. |
Definition at line 435 of file doorCriteria.cpp.
References gum::DiGraph::ancestors(), gum::Set< Key >::contains(), gum::DiGraph::descendants(), gum::Set< Key >::erase(), and gum::Set< Key >::insert().
Referenced by enumerateFrontdoorSets().
|
static |
Check if Z satisfies the backdoor criterion relative to (X, Y).
| dag | Directed acyclic graph representing the causal structure. |
| X | Cause variable. |
| Y | Effect variable. |
| Z | Conditioning set. |
Definition at line 110 of file doorCriteria.cpp.
References gum::Set< Key >::contains(), gum::DiGraph::descendants(), gum::Set< Key >::insert(), and gum::Separation::isBackdoorSeparated().
Referenced by _isMinimalBackdoorAdjustment().
|
static |
Check if Z satisfies the frontdoor criterion relative to (X, Y).
| dag | Directed acyclic graph representing the causal structure. |
| X | Cause variable. |
| Y | Effect variable. |
| Z | Conditioning set. |
Definition at line 133 of file doorCriteria.cpp.
References backdoorReach(), gum::Set< Key >::contains(), gum::Set< Key >::empty(), existsUnblockedDirectedPath(), gum::Set< Key >::insert(), gum::Separation::isBackdoorSeparated(), and gum::Separation::reduceForDSeparation().
Referenced by _isMinimalFrontdoorAdjustment().