forked from pool/python-networkx
26 lines
1.0 KiB
Diff
26 lines
1.0 KiB
Diff
|
From 7e4ddaa2e1745cdb3ed9969680d755ce81ddcdfd Mon Sep 17 00:00:00 2001
|
||
|
From: Ross Barnowski <rossbar@berkeley.edu>
|
||
|
Date: Mon, 5 Oct 2020 13:36:55 -0700
|
||
|
Subject: [PATCH] TST: Modify heuristic for astar path test.
|
||
|
|
||
|
Replace hash() with a sum-of-squares heuristic in
|
||
|
test_weight_functions so that the heuristic is not
|
||
|
platform-dependent.
|
||
|
---
|
||
|
networkx/algorithms/shortest_paths/tests/test_weighted.py | 2 +-
|
||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/networkx/algorithms/shortest_paths/tests/test_weighted.py b/networkx/algorithms/shortest_paths/tests/test_weighted.py
|
||
|
index b234618c4c..a4ba92c023 100644
|
||
|
--- a/networkx/algorithms/shortest_paths/tests/test_weighted.py
|
||
|
+++ b/networkx/algorithms/shortest_paths/tests/test_weighted.py
|
||
|
@@ -198,7 +198,7 @@ def test_bidirectional_dijkstra(self):
|
||
|
|
||
|
def test_weight_functions(self):
|
||
|
def heuristic(*z):
|
||
|
- return hash(z)
|
||
|
+ return sum(val ** 2 for val in z)
|
||
|
|
||
|
def getpath(pred, v, s):
|
||
|
return [v] if v == s else getpath(pred, pred[v], s) + [v]
|