Skip to main content
ARCHOS 525 BLUEPRINT · /d/dgm_code-graph-traversal-bfs-dfs

Graph Traversal (BFS Shortest Hop, DFS Cycles & Iterative Safety)

6 COMPONENTS · 6 FLOWS · UPDATED 2026-11-24
GITHUB README / PR PREVIEW CARD
[![Graph Traversal (BFS Shortest Hop, DFS Cycles & Iterative Safety) — ArchOS Architecture](https://archos.sageideas.dev/d/dgm_code-graph-traversal-bfs-dfs/opengraph-image)](https://archos.sageideas.dev/d/dgm_code-graph-traversal-bfs-dfs)

*Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_code-graph-traversal-bfs-dfs)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_code-graph-traversal-bfs-dfs" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Graph Traversal (BFS Shortest Hop, DFS Cycles & Iterative Safety) — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
  client_0["Graph Adjacency List"]
  n1_1[("Visited / Color State")]
  n2a_2[("BFS Level Queue")]
  n2b_3["Iterative DFS Stack"]
  n3_4["Reachability / Path"]
  downstream_5["Downstream & OTel"]
  client_0 -->|"1. Mark state · Array/Se"| n1_1
  n1_1 -->|"2a. Pop FIFO · OV+E"| n2a_2
  n1_1 -->|"2b. Explore · OV+E"| n2b_3
  n2a_2 -->|"3a. Emit path · OV+E"| n3_4
  n2b_3 -->|"3b. Merge · RAM"| n3_4
  n3_4 -.->|"4. Emit / · OTLP/API"| downstream_5

COMPONENT STACK (6)

  • Graph Adjacency ListSTATELESS
    Nodes V + Edges E
  • Visited / Color StateSTATEFUL
    0=Unvisited, 1=Active, 2=Done
  • BFS Level QueueSTATEFUL
    Unweighted shortest path + multi-src
  • Iterative DFS StackSTATELESS
    Avoids stack overflow on deep graphs
  • Reachability / PathSTATELESS
    Parent pointers reconstruct path
  • Downstream & OTelSTATELESS
    Consumers, metrics & SLOs

REQUEST & DATA FLOW (6)

  1. Graph Adjacency List → Visited / Color State (Mark state)[Array/Se]
  2. Visited / Color State → BFS Level Queue (Pop FIFO)[OV+E]
  3. Visited / Color State → Iterative DFS Stack (Explore)[OV+E]
  4. BFS Level Queue → Reachability / Path (Emit path)[OV+E]
  5. Iterative DFS Stack → Reachability / Path (Merge)[RAM]
  6. Reachability / Path → Downstream & OTel (Emit /)[OTLP/API]
Configure NGINX / Postgres / K8s →60-Sec L4–L7 Diagnostic →