We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5fe84b5 commit 0bd8b9cCopy full SHA for 0bd8b9c
graphs/travlelling_salesman_problem.py
@@ -63,7 +63,7 @@ def travelling_salesman_brute_force(
63
64
>>> graph = {"A": [10, 20], "B": [30, 21], "C": [15, 35]}
65
>>> travelling_salesman_brute_force(graph)
66
- (['A', 'B', 'C', 'A'], 65.52370249788875)
+ (['A', 'C', 'B', 'A'], 56.35465722402587)
67
>>> travelling_salesman_brute_force({})
68
Traceback (most recent call last):
69
...
@@ -107,7 +107,7 @@ def travelling_salesman_dynamic_programming(
107
108
109
>>> travelling_salesman_dynamic_programming(graph)
110
111
>>> travelling_salesman_dynamic_programming({})
112
113
@@ -167,6 +167,7 @@ def travelling_salesman_dynamic_programming(
167
168
path.append(nodes[0])
169
path.reverse()
170
+ path.append(nodes[0])
171
172
return path, min_cost
173
0 commit comments