mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-10 14:23:43 +08:00
Avoid mutable default arguments (#4691)
This commit is contained in:
@ -168,11 +168,11 @@ def construct_graph(cluster, nodes):
|
||||
return graph
|
||||
|
||||
|
||||
def myDFS(graph, start, end, path=[]):
|
||||
def myDFS(graph, start, end, path=None):
|
||||
"""
|
||||
find different DFS walk from given node to Header node
|
||||
"""
|
||||
path = path + [start]
|
||||
path = (path or []) + [start]
|
||||
if start == end:
|
||||
paths.append(path)
|
||||
for node in graph[start]:
|
||||
|
Reference in New Issue
Block a user