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

Function label_selectivity_values

nodedb-graph/src/csr/statistics.rs:289–302  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

287
288 #[test]
289 fn label_selectivity_values() {
290 let mut csr = CsrIndex::new();
291 csr.add_edge("a", "KNOWS", "b").unwrap();
292 csr.add_edge("b", "KNOWS", "c").unwrap();
293 csr.add_edge("a", "LIKES", "c").unwrap();
294 csr.compact().expect("no governor, cannot fail");
295
296 let sel_knows = csr.label_selectivity("KNOWS");
297 let sel_likes = csr.label_selectivity("LIKES");
298
299 assert!((sel_knows - 2.0 / 3.0).abs() < 1e-9);
300 assert!((sel_likes - 1.0 / 3.0).abs() < 1e-9);
301 assert_eq!(csr.label_selectivity("NONEXISTENT"), 1.0);
302 }
303
304 #[test]
305 fn statistics_serde_roundtrip() {

Callers

nothing calls this directly

Calls 4

add_edgeMethod · 0.80
label_selectivityMethod · 0.80
expectMethod · 0.45
compactMethod · 0.45

Tested by

no test coverage detected