MCPcopy Create free account
hub / github.com/Pometry/Raphtory / create_mutable_graph

Function create_mutable_graph

raphtory-graphql/src/model/graph/mutable_graph.rs:887–926  ·  view source on GitHub ↗
(port: u16, work_dir: &Path)

Source from the content-addressed store, hash-verified

885 }
886
887 async fn create_mutable_graph(port: u16, work_dir: &Path) -> GraphTestContext {
888 let graph = create_test_graph();
889 let config = AppConfig::default();
890 let data = Data::new(work_dir, &config, Config::default());
891
892 let graph_name = "test_graph";
893
894 let overwrite = false;
895 let folder = data
896 .work_dir_write()
897 .await
898 .validate_path_for_insert(graph_name, overwrite)
899 .unwrap();
900 data.insert_graph(folder, graph).await.unwrap();
901 let template = DocumentTemplate {
902 node_template: Some("{{ name }} is a {{ node_type }}".to_string()),
903 edge_template: Some("{{ src.name }} appeared with {{ dst.name}}".to_string()),
904 };
905
906 let embedding_server = serve_custom_embedding(None, port, fake_embedding).await;
907
908 let config = OpenAIEmbeddings::new("whatever", format!("http://localhost:{port}"));
909 let vector_cache = data.vector_cache.resolve().await.unwrap();
910 let model = vector_cache.openai(config.into()).await.unwrap();
911 data.vectorise_folder(
912 &ExistingGraphFolder::try_from(data.work_dir_read().await, graph_name).unwrap(),
913 &template,
914 model,
915 )
916 .await
917 .unwrap();
918
919 let graph_with_vectors = data.get_graph_for_test(graph_name).await.unwrap();
920 let mutable_graph = GqlMutableGraph::from(graph_with_vectors);
921
922 GraphTestContext {
923 mutable_graph,
924 embedding_server,
925 }
926 }
927
928 #[tokio::test]
929 async fn test_add_nodes_empty_list() {

Callers 4

test_add_nodes_simpleFunction · 0.85
test_add_edges_simpleFunction · 0.85

Calls 13

serve_custom_embeddingFunction · 0.85
unwrapMethod · 0.80
work_dir_writeMethod · 0.80
insert_graphMethod · 0.80
to_stringMethod · 0.80
openaiMethod · 0.80
vectorise_folderMethod · 0.80
work_dir_readMethod · 0.80
get_graph_for_testMethod · 0.80
create_test_graphFunction · 0.70
resolveMethod · 0.45

Tested by 4

test_add_nodes_simpleFunction · 0.68
test_add_edges_simpleFunction · 0.68