The PC algorithm, named after its creators Peter Spirtes and Clark Glymour, is a constraint-based causal discovery algorithm that learns the structure of a causal directed acyclic graph (DAG) or its Markov equivalence class from purely observational data. It operates by systematically testing for conditional independence between every pair of variables, progressively removing edges where independence is found, and then orienting remaining edges using collider detection rules.
Glossary
PC Algorithm

What is the PC Algorithm?
A foundational constraint-based method for learning causal structures from observational data by systematically testing conditional independence relationships.
The algorithm proceeds in two phases: an adjacency phase that starts with a fully connected graph and iteratively removes edges between variables found to be independent given conditioning sets of increasing size, and an orientation phase that applies deterministic rules to direct edges based on identified v-structures (colliders). The output is a completed partially directed acyclic graph (CPDAG) representing all causal structures consistent with the observed conditional independencies.
Key Characteristics of the PC Algorithm
The PC algorithm, named after its creators Peter Spirtes and Clark Glymour, is a foundational constraint-based causal discovery method that infers causal structures from observational data by systematically testing conditional independence relationships.
Constraint-Based Architecture
The PC algorithm operates by testing conditional independence between every pair of variables, progressively conditioning on larger subsets of variables. It begins with a fully connected undirected graph and iteratively removes edges when a separating set is found that renders two variables conditionally independent.
- Skeleton identification: Removes edges between variables that are independent given any subset of other variables
- V-structure orientation: Orients colliders (X → Z ← Y) when two non-adjacent variables both cause a common effect
- Meek rules: Applies deterministic orientation rules to propagate directionality without creating cycles
Faithfulness Assumption
The algorithm relies on the causal faithfulness assumption, which states that all conditional independencies observed in the data are entailed by the true causal graph structure, not by accidental parameter cancellations.
- Causal Markov condition: Each variable is independent of its non-descendants given its direct causes
- No accidental cancellations: The algorithm assumes positive and negative effects do not perfectly cancel each other out
- Violation example: If gene A upregulates protein B by +2 units and gene C downregulates B by -2 units, faithfulness is violated because A and C appear independent of B despite causal connections
Skeleton Discovery Phase
The first phase constructs an undirected skeleton by testing independence between each pair of variables (X, Y) conditional on subsets of adjacent variables. The algorithm starts with conditioning set size 0 and increases incrementally.
- Adjacency search: For each pair, tests independence given all subsets of size k from the current adjacency set
- Separation sets (SepSet): Records the conditioning set that makes two variables independent
- Computational complexity: Worst-case exponential in the maximum degree of the graph, but efficient for sparse causal structures common in biomedicine
- Typical test: Partial correlation test for Gaussian data or G² test for discrete variables
V-Structure Orientation
After skeleton discovery, the algorithm identifies unshielded colliders (v-structures) where two non-adjacent parents share a common child. This is the only structural pattern that can be uniquely oriented from observational data alone.
- Collider rule: If X and Y are not adjacent but both are adjacent to Z, and Z is NOT in the separation set of X and Y, then orient X → Z ← Y
- Biological example: A genetic variant and an environmental factor may both independently cause a disease biomarker, forming a v-structure
- Critical for causal direction: V-structures provide the asymmetry needed to distinguish causation from mere correlation
Output: Completed Partially Directed Acyclic Graph
The final output is a CPDAG (Completed Partially Directed Acyclic Graph) that represents the Markov equivalence class of all DAGs consistent with the observed independence patterns.
- Directed edges (→): Causally oriented with high confidence
- Undirected edges (—): Direction cannot be determined from observational data alone; multiple causal structures are equally consistent
- Equivalence class: All DAGs with the same skeleton and v-structures are observationally indistinguishable without interventional data
- Practical implication: In biomarker discovery, undirected edges indicate where follow-up perturbation experiments are needed
Biomedical Applications
The PC algorithm is widely applied in molecular causal discovery to infer regulatory networks and identify potential drug targets from high-dimensional omics data.
- Gene regulatory networks: Reconstructs causal relationships between transcription factors and target genes from expression data
- Protein signaling cascades: Maps directional influence in phosphoproteomic time-course experiments
- Disease pathway reconstruction: Identifies upstream drivers versus downstream biomarkers in patient cohorts
- Integration with Mendelian randomization: PC algorithm can suggest candidate causal structures that are then validated using genetic instruments
Frequently Asked Questions
Clear, technically precise answers to the most common questions about the PC algorithm, its mechanics, assumptions, and role in causal inference pipelines.
The PC algorithm is a constraint-based causal discovery algorithm named after its creators, Peter Spirtes and Clark Glymour, that learns a partial ancestral graph (PAG) or completed partially directed acyclic graph (CPDAG) from observational data by systematically testing conditional independence relationships. It operates in two phases: first, it identifies the skeleton of the causal graph by starting with a fully connected undirected graph and iteratively removing edges between variables that are conditionally independent given some subset of other variables. Second, it orients edges by applying a set of deterministic rules that exploit v-structure colliders (where two non-adjacent variables both cause a common effect) and propagation constraints to infer causal direction. The algorithm's statistical foundation relies on the Causal Markov Condition and Causal Faithfulness assumptions, which together ensure that the conditional independencies observed in the data correspond exactly to d-separation relationships in the true underlying causal directed acyclic graph (DAG). The PC algorithm is particularly valued in biomedicine for generating hypotheses about causal relationships among molecular variables without requiring prior experimental interventions.
PC Algorithm vs. Other Causal Discovery Methods
A comparative analysis of the PC algorithm against alternative causal discovery frameworks based on assumptions, outputs, and computational characteristics.
| Feature | PC Algorithm | Greedy Equivalence Search (GES) | LiNGAM |
|---|---|---|---|
Methodological Class | Constraint-based | Score-based | Functional causal model-based |
Core Mechanism | Systematic conditional independence testing | Greedy optimization of a penalized likelihood score | Independent component analysis on non-Gaussian residuals |
Output Representation | Completed Partial Directed Acyclic Graph (CPDAG) | Completed Partial Directed Acyclic Graph (CPDAG) | Fully directed acyclic graph (DAG) |
Handles Latent Confounders | |||
Assumes Causal Sufficiency | |||
Linearity Assumption | |||
Distributional Assumption | None (nonparametric tests available) | Multivariate Gaussian or penalized likelihood | Non-Gaussian error terms |
Scalability to High-Dimensional Data | Moderate (exponential worst-case, heuristics available) | High (efficient greedy search) | Low (cubic complexity in variables) |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
The PC Algorithm operates within a broader framework of causal inference and graphical modeling. Understanding these related concepts is essential for applying the algorithm correctly and interpreting its output.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us