skrawcz commented on code in PR #1483:
URL: https://github.com/apache/hamilton/pull/1483#discussion_r2899251567


##########
hamilton/graph.py:
##########
@@ -1091,13 +1090,19 @@ def directional_dfs_traverse(
         nodes = set()
         user_nodes = set()
 

Review Comment:
   made it the same.



##########
hamilton/graph.py:
##########
@@ -1091,13 +1090,19 @@ def directional_dfs_traverse(
         nodes = set()
         user_nodes = set()
 
-        def dfs_traverse(node: node.Node):
-            nodes.add(node)
-            for n in next_nodes_fn(node):
-                if n not in nodes:
-                    dfs_traverse(n)
-            if node.user_defined:
-                user_nodes.add(node)
+        def dfs_traverse_iterative(start_node: node.Node):
+            """Iterative DFS to avoid recursion depth limits with large 
DAGs."""
+            stack = [start_node]
+            while stack:
+                n = stack.pop()
+                if n in nodes:
+                    continue
+                nodes.add(n)
+                if n.user_defined:
+                    user_nodes.add(n)
+                for next_n in next_nodes_fn(n):
+                    if next_n not in nodes:
+                        stack.append(next_n)

Review Comment:
   yep, fixed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to