DSEP is a command-line tool written in Rust for analyzing causal graphs using d-separation — a graphical criterion for determining conditional independence in Directed Acyclic Graphs (DAGs). It is aimed at researchers, epidemiologists, and statisticians who work with causal diagrams and need to identify confounding paths, validate adjustment sets, or find minimal separating sets between variables.
Given a causal DAG specification (e.g., a->b->c or
exposure<-confounder->outcome), DSEP can:
- Parse and construct a causal DAG from a concise arrow notation (
->,<-) - Classify nodes as Exposure (input), Outcome, Adjustment, or Unknown
- Validate adjustment sets: check whether a given set of conditioning variables d-separates the exposure from the outcome
- Find minimal d-separating sets: identify the smallest set of variables that blocks all paths between two nodes
- Visualize the DAG as a color-coded SVG diagram
- Read DAG definitions from command-line arguments, files, or standard input
# Check if {Z} d-separates X and Y in X -> Z -> Y
dsep "X->Z->Y" -e X -o Y -a Z --check-adjustment
# Find a minimal d-separator
dsep "X->Z->Y" -e X -o Y --min-d-separation
# Generate an SVG visualization
dsep "X->Z->Y" --svg-file-name diagram.svgClone the repository and cd into it:
git clone https://github.com/wilswer/dsep.git && cd dsepInstall using cargo:
cargo install --path .