SIM
11 · CLEARING

Cycle Detection

STATUS
ACTIVE
SPEC
NIL-005
VERSION
0.7.0
UPDATED
2026-01-12

Procedure

At each Netting Epoch, the network scans the obligation graph for directed cycles — sequences of domains where each owes the next, and the last owes the first. For each cycle found, the minimum edge weight along that cycle is subtracted from every edge in it, cancelling that portion of every obligation in the cycle simultaneously.

cycle: LD-A → LD-B → LD-C → LD-A
weights: 440, 390, 370
min(cycle) = 370
result: 70, 20, 0   (LD-C → LD-A cancelled entirely)

This repeats until no positive-weight cycle remains in the graph.

Cost and Optimality

Cycle cancellation is greedy: it produces a valid, safe compression quickly, but not necessarily the theoretical minimum. A bounded flow-minimization pass runs at epoch close (see NIL-R01 §4) to further reduce the residual graph where computation budget allows.