From 682ad87ddf9ab3eb48d42dc9826d2d90c4031da3 Mon Sep 17 00:00:00 2001 From: markopy <48253511+markopy@users.noreply.github.com> Date: Sat, 3 Oct 2020 16:28:54 +0100 Subject: [PATCH] Fix issue #321 --- hdbscan/_hdbscan_linkage.pyx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hdbscan/_hdbscan_linkage.pyx b/hdbscan/_hdbscan_linkage.pyx index cec85f95..8c454d1c 100644 --- a/hdbscan/_hdbscan_linkage.pyx +++ b/hdbscan/_hdbscan_linkage.pyx @@ -182,14 +182,16 @@ cdef class UnionFind (object): return cdef np.intp_t fast_find(self, np.intp_t n): - cdef np.intp_t p + cdef np.intp_t p, tmp p = n while self.parent[n] != -1: n = self.parent[n] # label up to the root if this is not the root already if p != n: while self.parent[p] != n: - p, self.parent[p] = self.parent[p], n + tmp = self.parent[p] + self.parent[p] = n + p = tmp return n