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

Function _write

tests/test_mcp_graph_view_cache.py:24–35  ·  view source on GitHub ↗
(tmp_path, edges, name="graph.json")

Source from the content-addressed store, hash-verified

22
23
24def _write(tmp_path, edges, name="graph.json"):
25 G = nx.Graph()
26 for n in sorted({n for e in edges for n in e[:2]}):
27 G.add_node(n, label=f"{n}_fn", source_file=f"{n}.py", source_location="L1", community=0)
28 data = json_graph.node_link_data(G, edges="links")
29 data["links"] = [
30 {"source": u, "target": v, "relation": rel, "confidence": "EXTRACTED", "context": ctx}
31 for u, v, rel, ctx in edges
32 ]
33 path = tmp_path / name
34 path.write_text(json.dumps(data))
35 return path
36
37
38EDGES = [

Calls 1

add_nodeMethod · 0.95

Tested by

no test coverage detected