Class RecursiveBlocking
RecursiveBlocking class implements a recursive procedure for
constructing candidate separating sets between two nodes under PAG semantics.
Given distinct nodes x and y, the algorithm attempts to build a set Z that
blocks all blockable paths between x and y, starting from an optional seed set
of nodes to include. If such a set is found, it is returned and may later be
tested against the distribution for conditional independence. If any path is
provably un-blockable (or the analysis is interrupted or inconclusive), the
routine returns null, indicating that no valid graphical separating
set exists.
Key features:
- Respects PAG semantics for colliders, non-colliders, and latent nodes.
- Supports path length limits and "do not follow" constraints.
- Can be run with or without background knowledge (currently unused, but supported for extension).
- Returns a candidate blocking set agnostic to adjacency: the presence of a direct edge x–y does not preempt construction, but such an edge may prevent a valid separator from existing.
In the context of FCIT and related algorithms, the returned set is always subject to a statistical independence test to confirm whether it functions as an actual separating set in the distribution.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe Blockable enum represents the state of an entity in relation to its ability to be blocked. -
Method Summary
Modifier and TypeMethodDescriptionblockPathsRecursively(Graph graph, Node x, Node y, Set<Node> containing, Set<Node> notFollowed, int maxPathLength) Attempts to construct a candidate blocking set Z between nodes x and y under PAG semantics.blockPathsRecursively(Graph graph, Node x, Node y, Set<Node> containing, Set<Node> notFollowed, int maxPathLength, Knowledge knowledge) Variant ofblockPathsRecursively(Graph, Node, Node, Set, Set, int)that additionally accepts an optionalKnowledgeobject.static RecursiveBlocking.BlockablefindPathToTarget(Graph graph, Node a, Node b, Node y, Set<Node> path, Set<Node> z, int maxPathLength, Set<Node> notFollowed, Map<Node, Set<Node>> descendantsMap) Evaluates whether all paths from a→b onward to y can be blocked by the current candidate set Z, possibly augmented with b.
-
Method Details
-
blockPathsRecursively
public static Set<Node> blockPathsRecursively(Graph graph, Node x, Node y, Set<Node> containing, Set<Node> notFollowed, int maxPathLength) throws InterruptedException Attempts to construct a candidate blocking set Z between nodes x and y under PAG semantics. The returned set Z contains the nodes incontainingand is augmented as needed to block all blockable paths from x to y, ignoring any direct edge x–y on the first step.Semantics:
- If x and y are adjacent, this method does not produce a separating
set (returns
null). - If x and y are not adjacent, the routine returns a candidate blocking set Z if all blockable paths can be blocked. This set is only a graphical sepset and must be validated with an independence test.
- If some path is un-blockable or the recursion is indeterminate
(e.g., interrupted or exceeds
maxPathLength), the method returnsnull.
- Parameters:
graph- the PAG structurex- first endpointy- second endpointcontaining- nodes that must be included in the blocking setnotFollowed- nodes that should not be traversed intomaxPathLength- maximum allowed path length (-1 for unlimited)- Returns:
- a candidate blocking set Z if all blockable paths can be blocked, or
nullif no valid graphical separating set exists - Throws:
InterruptedException- if the search is interrupted
- If x and y are adjacent, this method does not produce a separating
set (returns
-
blockPathsRecursively
public static Set<Node> blockPathsRecursively(Graph graph, Node x, Node y, Set<Node> containing, Set<Node> notFollowed, int maxPathLength, Knowledge knowledge) throws InterruptedException Variant ofblockPathsRecursively(Graph, Node, Node, Set, Set, int)that additionally accepts an optionalKnowledgeobject.Currently, the
knowledgeargument is reserved for future extensions and is not applied in this routine, but it is passed along to maintain compatibility with knowledge-aware search strategies.- Parameters:
graph- the PAG structurex- first endpointy- second endpointcontaining- nodes that must be included in the blocking setnotFollowed- nodes that should not be traversed intomaxPathLength- maximum allowed path length (-1 for unlimited)knowledge- optional background knowledge (currently unused here)- Returns:
- a candidate blocking set Z if all blockable paths can be blocked, or
nullif no valid graphical separating set exists - Throws:
InterruptedException- if the search is interrupted
-
findPathToTarget
public static RecursiveBlocking.Blockable findPathToTarget(Graph graph, Node a, Node b, Node y, Set<Node> path, Set<Node> z, int maxPathLength, Set<Node> notFollowed, Map<Node, Set<Node>> descendantsMap) throws InterruptedExceptionEvaluates whether all paths from a→b onward to y can be blocked by the current candidate set Z, possibly augmented with b.The method explores continuations from the triple (a, b, c) under PAG semantics and returns one of three outcomes:
BLOCKED— all continuations through b are blocked given the current Z (with or without conditioning on b).UNBLOCKABLE— some continuation cannot be blocked even after adding b to Z.INDETERMINATE— traversal was aborted (interrupted or path length exceeded) or could not be decided safely.
Special cases:
- If b == y, the path immediately certifies as
UNBLOCKABLE. - If b has already been visited in the current path, it is treated as
UNBLOCKABLE(cycle guard). - If b is in
notFollowed, the branch is aborted asINDETERMINATE. - If y is in
notFollowed, that branch is treated asBLOCKED(refusing to follow into y cannot make paths less blockable).
Traversal policy:
- If b is latent or already in Z, traversal continues without conditioning on b.
- Otherwise, the method first tries to block without conditioning on b. If that fails, it retries with b added to Z, rolling back if this does not succeed.
Path bookkeeping: after adding b to the current path, this method guarantees that b is removed again before returning.
- Parameters:
graph- the PAG structurea- predecessor node in the pathb- current node under considerationy- target node to be separated from xpath- nodes visited so far (cycle guard)z- current candidate blocking setmaxPathLength- maximum allowed path length (-1 for unlimited)notFollowed- nodes not to be traversed intodescendantsMap- precomputed node→descendants map (for collider checks)- Returns:
- one of
BLOCKED,UNBLOCKABLE, orINDETERMINATE - Throws:
InterruptedException- if the traversal is interrupted
-