Skip to main content

cycles

Function cycles 

Source
pub fn cycles(issues: &[PlanIssue]) -> Vec<Vec<String>>
Expand description

Every dependency cycle of the issue graph, each as its strongly connected component in canonical order, the components themselves in canonical order.

Tarjan’s algorithm, with the roots visited in canonical order so the answer is the same on every run and on every machine. A component of one node is a cycle only when the issue depends on itself; the plan reports that separately as self_dependency and it is included here too, because a reader fixing cycles wants both.

use majordomus_cli::devtask::graph::cycles;
let issues = vec![node("A", &["B"]), node("B", &["A"]), node("C", &[])];
assert_eq!(cycles(&issues), vec![vec!["A".to_string(), "B".to_string()]]);