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

Function visualize_dag

integuru/util/print.py:71–93  ·  view source on GitHub ↗

Visualizes the DAG using Matplotlib with arrows indicating direction.

(graph: nx.DiGraph)

Source from the content-addressed store, hash-verified

69
70
71def visualize_dag(graph: nx.DiGraph) -> None:
72 """
73 Visualizes the DAG using Matplotlib with arrows indicating direction.
74 """
75 plt.switch_backend("Agg")
76
77 pos = nx.spring_layout(graph)
78
79 nx.draw_networkx_nodes(graph, pos, node_size=700, node_color="lightblue")
80
81 nx.draw_networkx_edges(
82 graph, pos, edgelist=graph.edges, arrowstyle="->", arrowsize=20
83 )
84
85 labels = {node: f"{node}" for node in graph.nodes()}
86 nx.draw_networkx_labels(graph, pos, labels, font_size=10)
87
88 edge_labels = nx.get_edge_attributes(graph, "cUrl")
89 nx.draw_networkx_edge_labels(graph, pos, edge_labels=edge_labels)
90
91 plt.title("Directed Acyclic Graph (DAG)")
92 plt.savefig("dag_visualization.png")
93 plt.close()
94
95
96def find_json_path(json_obj, target_value, current_path=None):

Callers 1

check_end_conditionFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected