Skip to main content
ARCHOS 525 BLUEPRINT · /d/dgm_code-cycle-detection

Cycle Detection in Sequences & Graphs (Floyd Tortoise-Hare & 3-Color DFS)

6 COMPONENTS · 6 FLOWS · UPDATED 2026-11-24
GITHUB README / PR PREVIEW CARD
[![Cycle Detection in Sequences & Graphs (Floyd Tortoise-Hare & 3-Color DFS) — ArchOS Architecture](https://archos.sageideas.dev/d/dgm_code-cycle-detection/opengraph-image)](https://archos.sageideas.dev/d/dgm_code-cycle-detection)

*Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_code-cycle-detection)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_code-cycle-detection" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Cycle Detection in Sequences & Graphs (Floyd Tortoise-Hare & 3-Color DFS) — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
  client_0["Graph / Linked Pointer"]
  n1_1["Fast / Slow Pointers"]
  n2a_2[("3-Color DFS Tracker")]
  n2b_3[("Wait-For Lock Graph")]
  n3_4["Cycle Break / Abort"]
  downstream_5["Downstream & OTel"]
  client_0 -->|"1. Step 1x/2x · Floyd"| n1_1
  n1_1 -->|"2a. Check Gray · DFS"| n2a_2
  n1_1 -->|"2b. Scan waits · Deadlock"| n2b_3
  n2a_2 -->|"3a. Break loop · Abort"| n3_4
  n2b_3 -->|"3b. Merge · RAM"| n3_4
  n3_4 -.->|"4. Emit / · OTLP/API"| downstream_5

COMPONENT STACK (6)

  • Graph / Linked PointerSTATELESS
    Locks, Redirects or Workflows
  • Fast / Slow PointersSTATELESS
    Floyd 2x vs 1x in O space
  • 3-Color DFS TrackerSTATEFUL
    Gray back-edge = directed cycle
  • Wait-For Lock GraphSTATEFUL
    Detects DB transaction deadlocks
  • Cycle Break / AbortSTATELESS
    Aborts youngest TX or bad redirect
  • Downstream & OTelSTATELESS
    Consumers, metrics & SLOs

REQUEST & DATA FLOW (6)

  1. Graph / Linked Pointer → Fast / Slow Pointers (Step 1x/2x)[Floyd]
  2. Fast / Slow Pointers → 3-Color DFS Tracker (Check Gray)[DFS]
  3. Fast / Slow Pointers → Wait-For Lock Graph (Scan waits)[Deadlock]
  4. 3-Color DFS Tracker → Cycle Break / Abort (Break loop)[Abort]
  5. Wait-For Lock Graph → Cycle Break / Abort (Merge)[RAM]
  6. Cycle Break / Abort → Downstream & OTel (Emit /)[OTLP/API]
Configure NGINX / Postgres / K8s →60-Sec L4–L7 Diagnostic →