MCPcopy Create free account
hub / github.com/Integuru-AI/Integuru / get_node_label

Function get_node_label

integuru/util/print.py:406–427  ·  view source on GitHub ↗

Generates a label for a node in the graph based on its attributes.

(graph: nx.DiGraph, node_id: str)

Source from the content-addressed store, hash-verified

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]

Callers 1

_print_dag_recursiveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected