Causality Analyzer
    Preparing search index...
    Index
    nodes: readonly string[]
    • All ancestors of the given nodes (including the nodes themselves). Uses iterative DFS on the transpose graph for stack-safety.

      Parameters

      • nodes: string[]

      Returns Set<string>

    • All descendants of node (including the node itself). Uses iterative DFS for stack-safety.

      Parameters

      • node: string

      Returns Set<string>

    • Strict d-separation test: are X and Y conditionally independent given Z?

      A trail (path treating edges as undirected) is d-connecting iff:

      1. For every non-collider node on the trail: it is NOT in Z.
      2. For every collider node on the trail: it IS in Z, or some descendant is in Z.

      Two nodes are d-separated by Z iff no d-connecting trail exists between them.

      Parameters

      • x: string

        — first node name

      • y: string

        — second node name

      • z: string[]

        — conditioning set (node names)

      Returns boolean

      true if X and Y are d-separated given Z

    • Whether there exists a directed path from from to to.

      Parameters

      • from: string
      • to: string

      Returns boolean

    • Convert a PDAG (partially directed acyclic graph) to a DAG.

      Algorithm (Dor & Tarsi 1992):

      1. Collect undirected edges (i—j where both i→j and j→i exist).
      2. While undirected edges remain: a. Find a sink among the undirected-component nodes: a node that has undirected edges but NO outgoing directed edges. b. Orient all undirected edges incident to the sink into the sink. c. Remove these edges from the undirected set.

      Returns CausalGraph

      a fully directed DAG