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

Function _write_graph

tests/test_god_nodes_cli.py:19–30  ·  view source on GitHub ↗
(tmp_path)

Source from the content-addressed store, hash-verified

17
18
19def _write_graph(tmp_path):
20 g = nx.DiGraph()
21 # A high-degree real entity (not a file/concept node): label != basename.
22 g.add_node("hub", label="Auth", file_type="code", source_file="auth.py", source_location="L1")
23 g.add_node("f", label="auth.py", file_type="code", source_file="auth.py", source_location=None)
24 for i in range(4):
25 g.add_node(f"caller{i}", label=f"c{i}()", file_type="code", source_file=f"m{i}.py", source_location="L1")
26 g.add_edge(f"caller{i}", "hub", relation="calls", confidence="EXTRACTED")
27 g.add_edge("f", "hub", relation="contains", confidence="EXTRACTED")
28 gp = tmp_path / "graph.json"
29 gp.write_text(json.dumps(json_graph.node_link_data(g, edges="links")), encoding="utf-8")
30 return gp
31
32
33def _run(monkeypatch, argv):

Calls 2

add_nodeMethod · 0.80
add_edgeMethod · 0.80

Tested by

no test coverage detected