MCPcopy Index your code
hub / github.com/OpenBMB/ToolBench / DFS

Function DFS

toolbench/tooleval/utils.py:133–145  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

131 elif 'DFS' in method:
132
133 def DFS(root):
134 if len(root['children']) == 0:
135 node = ExecutionNode(role=root['node_type'],message=root)
136 eg.add_node(node)
137 return node
138 else:
139 child_nodes = [DFS(node) for node in root['children']]
140 root['children'] = None
141 root_node = ExecutionNode(role=root['node_type'],message=root)
142 eg.add_node(root_node)
143 for child_node in child_nodes:
144 eg.add_edge(root_node,child_node)
145 return root_node
146 for node in data_dict['tree']['tree']['children']:
147 eg[last_node,DFS(node)] = None
148

Callers 1

process_invalid_dataFunction · 0.70

Calls 3

ExecutionNodeClass · 0.90
add_nodeMethod · 0.80
add_edgeMethod · 0.80

Tested by

no test coverage detected