Hypercausal Graph#
Hypercausal Graphs#
Directed acyclic graph (DAG) abstraction for deterministic evaluation of hypercausal nodes.
This module defines:
- Edge: a directed connection between nodes.
- HCGraph: a lightweight executor for hypercausal DAGs and chains.
- class qmlhc.hc.graph.HCGraph(nodes, edges)[source]#
Bases:
objectDirected acyclic graph (DAG) of hypercausal nodes with deterministic topological evaluation.
Nodes are executed respecting causal order. Missing explicit inputs are automatically derived from the mean of parent states.
Examples
>>> dag = HCGraph.chain(["A", "B", "C"], [nodeA, nodeB, nodeC]) >>> s_map, s_hat_map, info_map = dag.step({"A": x_t})
- __init__(nodes, edges)[source]#
Initialize a hypercausal DAG.
- Parameters:
- Raises:
ValueError – If no nodes are provided or if a cycle/self-loop is detected.
KeyError – If an edge references an unknown node.
- classmethod chain(names, nodes)[source]#
Build a linear chain of nodes
n0 -> n1 -> ... -> n_{L-1}.- Parameters:
- Returns:
Constructed linear chain graph.
- Return type:
- Raises:
ValueError – If
namesandnodeshave different lengths.
- step(x_map, s_tm1_map=None, branches=2)[source]#
Process one time step across the DAG.
- Parameters:
- Returns:
(s_map, s_hat_map, info_map)where: -s_map: dict[str, Array] Per-node current stateS_t. -s_hat_map: dict[str, Array] Per-node projected future stateŜ_{t+1}. -info_map: dict[str, Mapping[str, Any]] Auxiliary per-node diagnostics.- Return type:
- Raises:
KeyError – If a root node has no explicit input and no parent.