MCPcopy
hub / github.com/safishamsi/graphify / build

Function build

worked/mixed-corpus/raw/build.py:31–39  ·  view source on GitHub ↗

Merge multiple extraction results into one graph.

(extractions: list[dict])

Source from the content-addressed store, hash-verified

29
30
31def build(extractions: list[dict]) -> nx.Graph:
32 """Merge multiple extraction results into one graph."""
33 combined: dict = {"nodes": [], "edges": [], "input_tokens": 0, "output_tokens": 0}
34 for ext in extractions:
35 combined["nodes"].extend(ext.get("nodes", []))
36 combined["edges"].extend(ext.get("edges", []))
37 combined["input_tokens"] += ext.get("input_tokens", 0)
38 combined["output_tokens"] += ext.get("output_tokens", 0)
39 return build_from_json(combined)

Callers

nothing calls this directly

Calls 2

build_from_jsonFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected