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

Function cc

tests/test_undirected_graph.rs:117–127  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

115
116#[test]
117fn cc() {
118 let graph = create_graph(TINY_G);
119 let cc = CC::new(graph.as_ref());
120 assert_eq!(cc.count(), 3);
121 let mut components = vec![Vec::new(); cc.count()];
122 for v in 0..graph.V() {
123 components[cc.id(v)].push(v);
124 }
125 let expect = vec![vec![0, 1, 2, 3, 4, 5, 6], vec![7, 8], vec![9, 10, 11, 12]];
126 assert_eq!(expect, components);
127}
128
129#[test]
130fn cycle() {

Callers

nothing calls this directly

Calls 4

pushMethod · 0.80
create_graphFunction · 0.70
VMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected