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

Function _load_global_graph

graphify/global_graph.py:48–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46
47
48def _load_global_graph() -> nx.Graph:
49 if _GLOBAL_GRAPH.exists():
50 from graphify.security import check_graph_file_size_cap
51 check_graph_file_size_cap(_GLOBAL_GRAPH)
52 data = json.loads(_GLOBAL_GRAPH.read_text(encoding="utf-8"))
53 if "links" not in data and "edges" in data:
54 data = dict(data, links=data["edges"])
55 try:
56 return _jg.node_link_graph(data, edges="links")
57 except TypeError:
58 return _jg.node_link_graph(data)
59 return nx.Graph()
60
61
62def _save_global_graph(G: nx.Graph) -> None:

Calls 1