---
_version: '1'
uuid: 5918e1d4-da9e-4f77-934b-56161a25d48e
created: 2025-07-22T13:16:17.882526048Z
parents:
- uuid: 12fcd31d-7b7a-41d1-a072-66248ad6f86f
fingerprint: d7a6df07168a0b5e39ef8dea0fd0b33821f6e44630d20ea2d532f1520175baee
hrid: USR-004
---
# SYS-004 Cycle Detection in Requirement Graph
## Statement
The tool shall construct a directed acyclic graph (DAG) from requirement parent-child relationships and detect any cycles, reporting them as errors.
## Rationale
Cycles in requirement hierarchies create logical inconsistencies where requirements depend on themselves, either directly or transitively. This violates the fundamental principle of hierarchical decomposition and makes traceability analysis impossible. Early detection of cycles prevents invalid requirement structures from being committed and ensures the requirement graph remains mathematically sound for analysis operations.
## Implementation Notes
- Graph constructed from parent links in requirement frontmatter
- Cycle detection using depth-first search or topological sort
- Cycles violate hierarchical requirement structure
- Report full cycle path (e.g., "USR-001 → SYS-002 → USR-001")
## Verification
- Tool detects direct cycles (A → B → A)
- Tool detects indirect cycles (A → B → C → A)
- Tool reports complete cycle path in error message
- Tool rejects loading requirements with cycles
- Valid DAGs load without errors