MCPcopy Create free account
hub / github.com/douchuan/algorithm / acyclic_sp

Function acyclic_sp

tests/test_shortest_paths.rs:89–109  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

87
88#[test]
89fn acyclic_sp() {
90 let i = TINY_EWDAG;
91 let graph = create_graph(i);
92 let sp = AcyclicSP::new(graph.as_ref(), 5).unwrap();
93 for (i, (weight, size)) in vec![
94 (0.73, 2), // (dist_to(i), path_to(i).len())
95 (0.32, 1),
96 (0.62, 2),
97 (0.61, 2),
98 (0.35, 1),
99 (0.0, 0),
100 (1.13, 3),
101 (0.28, 1),
102 ]
103 .iter()
104 .enumerate()
105 {
106 assert_eq!(*size, sp.path_to(i).map_or(0, |path| path.len()));
107 assert_relative_eq!(*weight, sp.dist_to(i));
108 }
109}
110
111#[test]
112fn acyclic_lp() {

Callers

nothing calls this directly

Calls 2

create_graphFunction · 0.70
iterMethod · 0.45

Tested by

no test coverage detected