Skip to content

Commit 00e45ee

Browse files
Update datastructures/graphs/undirected/clone_graph/__init__.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent d1709d3 commit 00e45ee

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • datastructures/graphs/undirected/clone_graph

datastructures/graphs/undirected/clone_graph/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def clone_helper(n: Optional[Node], nodes_cloned: Dict[Node, Node]) -> Optional[
2020
# This checks if the neighbour node neighbour has already been cloned.
2121
cloned_neighbour = nodes_cloned.get(neighbour)
2222
# If the neighbour is not cloned yet, recursively clone it
23-
if not cloned_neighbour:
23+
if cloned_neighbour is None:
2424
cloned_node.neighbors += [clone_helper(neighbour, nodes_cloned)]
2525
# If the neighbour is already cloned, add the cloned neighbour to the new
2626
# node's neighbors

0 commit comments

Comments
 (0)