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

Function make_social_graph

nodedb/src/engine/graph/pattern/executor/mod.rs:368–396  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

366 use super::*;
367
368 fn make_social_graph() -> (CsrIndex, EdgeStore, tempfile::TempDir) {
369 let dir = tempfile::tempdir().unwrap();
370 let store = EdgeStore::open(&dir.path().join("graph.redb")).unwrap();
371
372 use crate::engine::graph::edge_store::EdgeRef;
373 use nodedb_types::TenantId;
374 const T: TenantId = TenantId::new(1);
375 let mut ord = 0i64;
376 let mut put = |src: &str, label: &str, dst: &str| {
377 ord += 1;
378 store
379 .put_edge_versioned(
380 EdgeRef::new(T, "col", src, label, dst),
381 b"",
382 ord,
383 ord,
384 i64::MAX,
385 )
386 .unwrap();
387 };
388 put("alice", "KNOWS", "bob");
389 put("bob", "KNOWS", "carol");
390 put("carol", "KNOWS", "dave");
391 put("alice", "LIKES", "carol");
392 put("bob", "BLOCKED", "dave");
393
394 let csr = crate::engine::graph::csr::rebuild::rebuild_from_store(&store).unwrap();
395 (csr, store, dir)
396 }
397
398 #[test]
399 fn execute_simple_one_hop() {

Callers 8

execute_simple_one_hopFunction · 0.85
execute_two_hopsFunction · 0.85
execute_optional_matchFunction · 0.85
execute_anti_joinFunction · 0.85
execute_with_limitFunction · 0.85
execute_empty_resultFunction · 0.85
execute_with_node_labelsFunction · 0.85

Calls 6

rebuild_from_storeFunction · 0.85
joinMethod · 0.80
put_edge_versionedMethod · 0.80
openFunction · 0.50
putFunction · 0.50
pathMethod · 0.45

Tested by 8

execute_simple_one_hopFunction · 0.68
execute_two_hopsFunction · 0.68
execute_optional_matchFunction · 0.68
execute_anti_joinFunction · 0.68
execute_with_limitFunction · 0.68
execute_empty_resultFunction · 0.68
execute_with_node_labelsFunction · 0.68