If continuing the iteration even when a cycle error is encountered, Kahn algorithm keeps reporting the cycle error forever. This makes the following code an infinite loop:
let toposort = TopoSort::on(&graph).kahn().run();
let sorted = toposort
// Ignore cycle errors.
.filter_map(|result| result.ok())
.collect::<Vec<_>>();
The desired behavior is described in #26, but until then the fix can just be to set a flag and return None when this flag is set.
If continuing the iteration even when a cycle error is encountered, Kahn algorithm keeps reporting the cycle error forever. This makes the following code an infinite loop:
The desired behavior is described in #26, but until then the fix can just be to set a flag and return
None
when this flag is set.