pub fn has_cycle(graph: &MaterializedGraph) -> bool
Cycle detection: returns true if the graph contains a cycle.