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])
| 30 | return func |
| 31 | |
| 32 | def 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 | |
| 47 | def 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] |
no test coverage detected