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

Function DFS

toolbench/tooleval/convert_to_answer_format.py:108–120  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

106 elif 'DFS' in method or 'dfs' in method:
107
108 def DFS(root):
109 if len(root['children']) == 0:
110 node = ExecutionNode(role=root['node_type'],message=root)
111 eg.add_node(node)
112 return node
113 else:
114 child_nodes = [DFS(node) for node in root['children']]
115 root['children'] = None
116 root_node = ExecutionNode(role=root['node_type'],message=root)
117 eg.add_node(root_node)
118 for child_node in child_nodes:
119 eg.add_edge(root_node,child_node)
120 return root_node
121 for node in data_dict['tree']['tree']['children']:
122 eg[last_node,DFS(node)] = None
123

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