Skip to content

Best Graph

best_graph

The best-graph command.

Functions:

  • best_graph_cmd –

    Extract optimal DAG from a PDG using greedy algorithm.

best_graph_cmd

best_graph_cmd(input: str, output: str, threshold: float) -> None

Extract optimal DAG from a PDG using greedy algorithm.

Reads a Probabilistic Dependency Graph (PDG) and extracts the best DAG by greedily selecting high-probability edges while avoiding cycles. Undirected probability is split equally between forward and backward directions.

For direction ties, alphabetical ordering is used (source -> target where source < target).

Creates output directory containing dag.graphml and _meta.json.

Example

causaliq-analysis best-graph -i merged.graphml -o results/optimal

causaliq-analysis best-graph -i merged.graphml -o results/optimal \ --threshold=0.5