MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / sssp_unreachable_node

Function sssp_unreachable_node

nodedb/src/engine/graph/algo/sssp.rs:162–178  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

160
161 #[test]
162 fn sssp_unreachable_node() {
163 let mut csr = CsrIndex::new();
164 csr.add_edge_weighted("a", "R", "b", 1.0).unwrap();
165 csr.add_node("island").unwrap();
166 csr.compact().expect("no governor, cannot fail");
167
168 let params = AlgoParams {
169 source_node: Some("a".into()),
170 ..Default::default()
171 };
172 let batch = run(&csr, &params).unwrap();
173 let dists = parse_results(&batch);
174
175 assert_eq!(dists["a"], 0.0);
176 assert_eq!(dists["b"], 1.0);
177 assert!(dists["island"].is_infinite());
178 }
179
180 #[test]
181 fn sssp_unweighted_defaults_to_one() {

Callers

nothing calls this directly

Calls 6

parse_resultsFunction · 0.85
add_edge_weightedMethod · 0.80
runFunction · 0.70
add_nodeMethod · 0.45
expectMethod · 0.45
compactMethod · 0.45

Tested by

no test coverage detected