Expand description
Topological algorithms: cycle detection and topological sort
Provides graph ordering algorithms needed for dependency analysis:
is_cyclic: Detect if a directed graph contains cyclestoposort: Topological ordering of a DAG (Directed Acyclic Graph)
§Example
use trueno_graph::{CsrGraph, NodeId, is_cyclic, toposort};
// Build a DAG: 0 → 1 → 2
let edges = vec![
(NodeId(0), NodeId(1), 1.0),
(NodeId(1), NodeId(2), 1.0),
];
let graph = CsrGraph::from_edge_list(&edges).unwrap();
assert!(!is_cyclic(&graph));
let order = toposort(&graph).unwrap();
assert_eq!(order, vec![NodeId(0), NodeId(1), NodeId(2)]);