MCPcopy Index your code
hub / github.com/douchuan/algorithm / cycle

Function cycle

tests/test_directed_graph.rs:102–115  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

100
101#[test]
102fn cycle() {
103 let graph = create_digraph(TINY_DG);
104 let cycle = DirectedCycle::from(graph.as_ref());
105 assert!(cycle.has_cycle());
106 assert!(cycle.cycle().unwrap().eq(vec![3, 5, 4, 3].iter()));
107 assert!(cycle.check().is_ok());
108
109 //DAG
110 let graph = create_digraph(TINY_DAG);
111 let cycle = DirectedCycle::from(graph.as_ref());
112 assert!(!cycle.has_cycle());
113 assert!(cycle.cycle().is_none());
114 assert!(cycle.check().is_ok());
115}
116
117#[test]
118fn topological() {

Callers

nothing calls this directly

Calls 1

create_digraphFunction · 0.85

Tested by

no test coverage detected