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

Function score_bound_vs_unbound

nodedb/src/engine/graph/pattern/optimizer.rs:280–312  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

278
279 #[test]
280 fn score_bound_vs_unbound() {
281 let csr = social_graph();
282
283 let triple = PatternTriple {
284 src: NodeBinding {
285 name: Some("a".into()),
286 label: None,
287 },
288 edge: EdgeBinding {
289 name: None,
290 edge_type: Some("KNOWS".into()),
291 direction: EdgeDirection::Right,
292 min_hops: 1,
293 max_hops: 1,
294 },
295 dst: NodeBinding {
296 name: Some("b".into()),
297 label: None,
298 },
299 };
300
301 let mut bound = std::collections::HashSet::new();
302 let unbound_score = score_triple(&triple, &csr, &bound);
303
304 bound.insert("a".to_string());
305 let one_bound_score = score_triple(&triple, &csr, &bound);
306
307 bound.insert("b".to_string());
308 let both_bound_score = score_triple(&triple, &csr, &bound);
309
310 assert!(one_bound_score < unbound_score);
311 assert!(both_bound_score < one_bound_score);
312 }
313
314 #[test]
315 fn score_variable_length_penalized() {

Callers

nothing calls this directly

Calls 4

social_graphFunction · 0.85
score_tripleFunction · 0.85
to_stringMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected