This Probability concept is the current idea: keep the same invariant visible across Intuition, Math, Code, Interactive Demo.
Probability
d-Separation
d-Separation is the graph test that says which conditional independencies a Bayesian-network DAG guarantees after evidence is observed.
Concept Structure
d-Separation
Start with the picture, metaphor, or geometric mechanism.
Make the objects explicit and connect them with notation.
Mirror the equations with runnable implementation details.
Manipulate the mechanism and watch the idea respond.
Learner Contract
What this page should let you do.
1 prerequisite listed; refresh them before leaning on the math or code.
Explain the mechanism, trace the main notation, and test one prediction in the live demo.
Read the intuition before the notation; the math should name a mechanism you already felt.
Follow this edge after making one prediction here; the next page should reuse the result, not restart the route.
Claim/source review status
Substantive review recorded
1/1 claims have bounded review metadata; still check caveats and source scope.Metadata-derived; review may be AI-assisted. Not a human certification.01
Intuition
Build the mental picture first so the rest of the page has something to attach to.
A Bayesian network is useful only if we can read more than parent lists from it. We also need to know which variables become irrelevant once evidence is observed.
That is the job of d-separation.
Start with a question such as:
Read it as: "Once Cloudy is known, does the graph guarantee that Sprinkler and Rain carry no extra information about each other?"
The answer is a graph question before it is a probability-table question. Forget arrow direction for a moment and look for every undirected trail between the query nodes. Evidence can block or open each trail.
Three local patterns do almost all the work:
- Chain: . Observing the middle node blocks the trail.
- Fork: . Observing the common cause blocks the trail.
- Collider: . The trail is closed by default, but observing opens it.
The collider rule is the strange one. It says evidence can create dependence. If Wet Grass is observed, Sprinkler and Rain become competing explanations for the same effect.
There is one more subtlety: observing a descendant of a collider also opens the collider. If Sprinkler and Rain both point to Wet Grass, and Wet Grass points to Late, then observing Late can make the Sprinkler--Wet Grass--Rain trail active even when Wet Grass itself is not observed.
So d-separation is not "draw arrows and follow causality." It is a trail audit:
- list the undirected trails between the query nodes;
- classify each middle node as a non-collider or collider;
- apply the evidence rule;
- check whether any whole trail stays active.
If no active trail remains, the DAG guarantees conditional independence for every distribution that factorizes over that graph. If at least one active trail remains, the graph does not guarantee independence. Special probability values might still cancel, but the graph alone no longer proves it.
02
Math
Translate the story into symbols, assumptions, and a derivation you can inspect.
Let be a directed acyclic graph for a Bayesian network. Let be disjoint sets of nodes. The set is the evidence or conditioning set.
An undirected trail
connects to if every adjacent pair is connected by a directed edge in either direction.
For each interior node with , inspect the triple
The middle node is a collider on this trail when both arrows point into it:
Otherwise it is a non-collider on the trail. Chains and forks are both non-collider cases for this purpose.
A trail is active given when every interior triple satisfies:
and
The node sets and are d-separated by when no active trail connects them:
For Bayesian networks, d-separation is sound:
for every distribution that factorizes over .
The reverse direction is not guaranteed for a particular parameterization. A distribution can contain extra numerical independencies that the graph does not encode. That is why the lab says "d-connected: no graph guarantee" rather than "definitely dependent."
03
Code
Keep the implementation aligned with the notation so the algorithm is legible.
edges = {("C", "S"), ("C", "R"), ("S", "W"), ("R", "W"),
("R", "T"), ("W", "L"), ("T", "L")}
nodes = "C S R W T L".split()
children = {n: [b for a, b in edges if a == n] for n in nodes}
def descendants(n):
out, stack = set(), list(children[n])
while stack:
x = stack.pop()
if x not in out:
out.add(x)
stack += children[x]
return out
def adjacent(a, b):
return (a, b) in edges or (b, a) in edges
def triple_kind(a, b, c):
if (a, b) in edges and (c, b) in edges:
return "collider"
return "non-collider"
def active_path(path, observed):
observed = set(observed)
for a, b, c in zip(path, path[1:], path[2:]):
if not adjacent(a, b) or not adjacent(b, c):
return False
if triple_kind(a, b, c) == "collider":
if b not in observed and not (descendants(b) & observed):
return False
elif b in observed:
return False
return True
tests = [
("fork blocked", ["S", "C", "R"], {"C"}),
("collider observed", ["S", "W", "R"], {"C", "W"}),
("descendant opens", ["S", "W", "R"], {"C", "L"}),
]
for name, path, z in tests:
print(name, active_path(path, z))
The code is a tiny teaching version of what graph libraries implement more generally. For production graph analysis, NetworkX exposes d-separation utilities such as is_d_separator for DAGs, but the hand-written version keeps the chain/fork/collider mechanism visible.
04
Interactive Demo
Use direct manipulation to connect the explanation to a moving system.
The lab below reuses the Bayesian Networks DAG. Pick the query and evidence case, predict whether the graph guarantees independence, then reveal every trail between the query nodes. The ledger stays locked until you commit, so you have to reason from the graph before seeing the active path.
Live Concept Demo
Explore d-Separation
The stage is code-native and interactive. Use it to test the explanation against the mechanism.
Manipulate one control and predict the visible change.
Commit to what d-Separation should make visible before reading the result.
After The First Pass
Turn the concept into an inspected object.
Once the invariant is visible in the intuition, math, code, and demo, use these panels to inspect the mechanism visually, check source support, practice the idea, and attach a grounded research question.
Mechanism Storyboard
See the idea move before the page explains it
d-Separation is the graph test that says which conditional independencies a Bayesian-network DAG guarantees after evidence is observed.
Start with the picture, metaphor, or geometric mechanism.
Before reading further, choose the kind of change d-Separation should make visible.
Visual Inquiry
Make the image answer a mathematical question
d-Separation is the graph test that says which conditional independencies a Bayesian-network DAG guarantees after evidence is observed.
Which visible object should carry the first intuition?
Pick the cue that should make d-Separation easier to reason about before the page gives the answer.
Source Grounding
Canonical references for the mechanism on this page.
Grounds active paths, common-parent/chain/v-structure cases, descendants of colliders, and the I-map caveat.
Open sourceSupports the three canonical triples, the path-enumeration algorithm, and the wording that d-connected means not guaranteed independent.
Open sourceProbabilistic-ML reference for graphical-model independence and inference context.
Open sourceCanonical PGM reference for the semantics and completeness limits of directed graphical-model independence maps.
Open sourceOfficial open-source graph-library reference for d-separation tests in DAGs and minimal d-separator utilities.
Open sourceClaim Review
d-Separation is the graph test that says which conditional independencies a Bayesian-network DAG guarantees after evidence is observed.
Claims without a substantive review badge still need exact source-support review.
cs228-d-separation, berkeley-cs188-d-separation, murphy-2022-probabilistic-ml, koller-friedman-2009-pgm, networkx-2026-d-separation
Use equations, runnable code, and demos to check whether the source support is operational.
The sources support the page's active-trail algorithm, the chain/fork/collider distinction, descendant-of-collider evidence, and the careful wording that d-separation gives an independence guarantee while d-connection only removes that graph-level guarantee.
Sources: Stanford CS228 Notes: Bayesian Networks, Berkeley CS188 Textbook: D-Separation, Probabilistic Machine Learning: An Introduction, Probabilistic Graphical Models: Principles and Techniques, NetworkX Documentation: D-SeparationFinite DAG teaching graph only; excludes do-calculus, causal identification, selection bias, latent confounding, cyclic graphs, Markov equivalence proofs, and a GPT Pro publication pass.A bounded review summary is present; still check caveats and exact reference scope.Checked Stanford CS228 directed-model notes for active-path rules, descendant-of-collider opening, and the I-map soundness caveat; checked Berkeley CS188 for chain/common-cause/common-effect examples and the path-enumeration procedure; checked NetworkX docs for practical open-source d-separation APIs and the graph-only nature of the test. GPT Pro publication critique remains pending because 127.0.0.1:51672 is unavailable.
Reviewer: codex-local-source-review; reviewed 2026-07-02Source support candidates
course-notes 2026Stanford CS228 Notes: Bayesian NetworksGrounds active paths, common-parent/chain/v-structure cases, descendants of colliders, and the I-map caveat.
course-notes 2026Berkeley CS188 Textbook: D-SeparationSupports the three canonical triples, the path-enumeration algorithm, and the wording that d-connected means not guaranteed independent.
book 2022Probabilistic Machine Learning: An IntroductionProbabilistic-ML reference for graphical-model independence and inference context.
book 2009Probabilistic Graphical Models: Principles and TechniquesCanonical PGM reference for the semantics and completeness limits of directed graphical-model independence maps.
Practice Loop
Try the idea before it explains itself
d-Separation is the graph test that says which conditional independencies a Bayesian-network DAG guarantees after evidence is observed.
Before touching the demo, predict one visible change that should happen in d-Separation.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
A concrete answer is on the canvas.
The answer names why the claim should hold.
It touches the page context or a neighboring idea.
Research Room
Attach the question to a claim, equation, code, or demo
Pick the concept, equation, source, runnable code, claim, misconception, or demo state before asking for help. The handoff keeps that page item in context.Open the draft below to save one note and next action in this browser.
d-Separation
What is the smallest example that makes d-Separation click without losing the math?
Local action draftNo local draft saved yetExpand only when ready to capture one local next action
This draft stays in this browser, attached to the selected learning item.
- References to inspect: attached references on this page.
- Definition, prerequisite, and contrast concept links
- The equation or runnable code that makes the concept operational
- One demo state that shows the invariant instead of a slogan
- The learner can state the mechanism in their own words
- The learner can name the prerequisite that would repair confusion
- The learner can predict how the mechanism changes under one perturbation
I am working in Continuous Function's research reading room. Object: concept - d-Separation Selected item key: recorded for copy. Context: Probability Page anchor: recorded for copy. Open question: What is the smallest example that makes d-Separation click without losing the math? Evidence to inspect: - References to inspect: attached references on this page. - Definition, prerequisite, and contrast concept links - The equation or runnable code that makes the concept operational - One demo state that shows the invariant instead of a slogan What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action.
concept/concept-notebook/probability/d-separation
concept:probability/d-separation