Expand description
§Canonical Graph Semantics Engine (CGSE)
Deterministic tie-break policies with complexity witness artifacts per algorithm family. This is FrankenNetworkX’s crown-jewel innovation: every algorithm declares its ordering policy at the type level, and every execution emits a cryptographic witness that proves which tie-break decisions were taken.
§Architecture
TieBreakPolicy: closed sum type with 13 named ordering variants.ComplexityWitness: per-execution record carrying(n, m, observed_ops, policy_id, decision_path_blake3).WitnessSink: thread-local collector that algorithms call on every tie-break decision.WitnessLedger: append-only log of witnesses, serializable to JSONL with RaptorQ sidecar support.
Structs§
- Algorithm
Family Policy - Declares the canonical tie-break policy for an algorithm family.
- Complexity
Bound Result - Result of complexity bound verification.
- Complexity
Witness - A per-execution record emitted by every CGSE-instrumented algorithm.
- Counter
Example - A counter-example candidate found during witness-hash mining.
- Mining
Config - Configuration for counter-example mining.
- Mining
Result - Result of a counter-example mining session.
- Witness
Ledger - Append-only ledger of
ComplexityWitnessrecords. - Witness
Sink - Collects tie-break decisions during a single algorithm execution.
Enums§
- Reference
Algorithm - The V1 reference algorithms whose call sites are wired through CGSE.
- TieBreak
Policy - The 13 canonical tie-break orderings that NetworkX algorithms exhibit.
Functions§
- analytic_
upper_ bound - Evaluate the analytic upper bound for a complexity class.
- assert_
complexity_ within_ bounds - Complexity oracle assertion: panic if witness exceeds expected bounds.
- collect_
witnesses - Run a closure with CGSE witness collection enabled and return the drained witnesses produced inside it.
- compare_
witnesses - Compares two witnesses for consistency.
- drain_
witnesses - Drain and return all witnesses from the thread-local ledger.
- generate_
random_ edges - Generates random graph edges for testing.
- mining_
result_ to_ jsonl - Serializes a mining result to JSONL format.
- v1_
policy_ registry - The canonical policy registry for V1 algorithms.
- verify_
complexity_ bound - Verify that a witness’s observed count is within the expected complexity bounds. Returns a result indicating whether the count is acceptable.
- verify_
witness_ determinism - Verifies witness determinism by running the same algorithm multiple times and checking for hash consistency.
- with_
ledger - Execute a closure with access to the thread-local witness ledger.
- witness_
collection_ enabled - Return whether CGSE witness collection is active for the current thread.