MCPcopy Create free account
hub / github.com/LangGraph-GUI/LangGraph-GUI-backend / parse_nodes_from_json

Function parse_nodes_from_json

src/WorkFlow.py:32–45  ·  view source on GitHub ↗

Parses node data from a subgraph's JSON structure. Args: graph_data: A dictionary representing a subgraph. Returns: A dictionary of NodeData objects keyed by their unique IDs.

(graph_data: Dict[str, Any])

Source from the content-addressed store, hash-verified

30 return func
31
32def parse_nodes_from_json(graph_data: Dict[str, Any]) -> Dict[str, NodeData]:
33 """
34 Parses node data from a subgraph's JSON structure.
35
36 Args:
37 graph_data: A dictionary representing a subgraph.
38 Returns:
39 A dictionary of NodeData objects keyed by their unique IDs.
40 """
41 node_map = {}
42 for node_data in graph_data.get("nodes", []):
43 node = NodeData.from_dict(node_data)
44 node_map[node.uniq_id] = node
45 return node_map
46
47def find_nodes_by_type(node_map: Dict[str, NodeData], node_type: str) -> List[NodeData]:
48 return [node for node in node_map.values() if node.type == node_type]

Callers 1

run_workflow_as_serverFunction · 0.85

Calls 1

from_dictMethod · 0.45

Tested by

no test coverage detected