Generates a label for a node in the graph based on its attributes.
(graph: nx.DiGraph, node_id: str)
| 404 | visited.remove(current_node_id) |
| 405 | |
| 406 | def get_node_label(graph: nx.DiGraph, node_id: str) -> str: |
| 407 | """ |
| 408 | Generates a label for a node in the graph based on its attributes. |
| 409 | """ |
| 410 | # Get node attributes |
| 411 | node_attrs = graph.nodes[node_id] |
| 412 | dynamic_parts = node_attrs.get("dynamic_parts", []) |
| 413 | extracted_parts = node_attrs.get("extracted_parts", "") |
| 414 | content = node_attrs.get("content", "") |
| 415 | key = content.get("key", "") |
| 416 | input_variables = node_attrs.get("input_variables", "") |
| 417 | |
| 418 | if dynamic_parts: |
| 419 | dynamic_parts_list.extend(dynamic_parts) |
| 420 | node_type = node_attrs.get("node_type", "") |
| 421 | node_label = f"[{node_type}] " |
| 422 | node_label += f"[node_id: {node_id}]" |
| 423 | node_label += f" [dynamic_parts: {dynamic_parts}]" |
| 424 | node_label += f" [extracted_parts: {extracted_parts}]" |
| 425 | node_label += f" [input_variables: {input_variables}]" |
| 426 | node_label += f" [{key}]" |
| 427 | return node_label |
| 428 | |
| 429 | # Start from source nodes (nodes with no incoming edges) |
| 430 | source_nodes = [n for n in graph.nodes() if graph.in_degree(n) == 0] |
no outgoing calls
no test coverage detected