Skip to content

Commit b52cba2

Browse files
committed
Fix RNG
1 parent 14cc7cc commit b52cba2

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

city2graph/proximity.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,8 +1098,9 @@ def relative_neighborhood_graph(
10981098
if np.any(dots < 0.0):
10991099
continue
11001100
dij2 = np.dot(coords[i] - coords[j], coords[i] - coords[j])
1101-
di2 = np.sum((coords - coords[i]) ** 2, axis=1) < dij2
1102-
dj2 = np.sum((coords - coords[j]) ** 2, axis=1) < dij2
1101+
threshold = dij2 - np.finfo(float).eps * max(dij2, 1.0) * 64.0
1102+
di2 = np.sum((coords - coords[i]) ** 2, axis=1) < threshold
1103+
dj2 = np.sum((coords - coords[j]) ** 2, axis=1) < threshold
11031104
closer_both = np.where(di2 & dj2)[0]
11041105
if len(closer_both) == 0:
11051106
kept_edges.add((builder.node_ids[i], builder.node_ids[j]))

0 commit comments

Comments
 (0)