MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _write_graph

Function _write_graph

tests/test_query_cli.py:17–26  ·  view source on GitHub ↗
(tmp_path)

Source from the content-addressed store, hash-verified

15
16
17def _write_graph(tmp_path):
18 G = nx.Graph()
19 G.add_node("n1", label="extract", source_file="extract.py", source_location="L10", community=0)
20 G.add_node("n2", label="cluster", source_file="cluster.py", source_location="L5", community=0)
21 G.add_node("n3", label="build", source_file="build.py", source_location="L1", community=1)
22 G.add_edge("n1", "n2", relation="calls", confidence="EXTRACTED", context="call")
23 G.add_edge("n2", "n3", relation="imports", confidence="EXTRACTED", context="import")
24 graph_path = tmp_path / "graph.json"
25 graph_path.write_text(json.dumps(json_graph.node_link_data(G, edges="links")))
26 return graph_path
27
28
29@pytest.mark.parametrize("mode", [[], ["--dfs"]])

Calls 2

add_nodeMethod · 0.95
add_edgeMethod · 0.95

Tested by

no test coverage detected