Skip to main content
. 2024 Dec 9;10:e2550. doi: 10.7717/peerj-cs.2550
Algorithm 2: Wishart clustering
Input: {x1xl}—objects, d(xixj)—distance function, k, h
Output: yi=yxii=1l—cluster labels
dk(xi)← distance to k-th nearest neighbour of xi
sort objects so that dkx1dkxl) the cluster c is defined to be a height-significant one, with respect to height value h > 0 if maxxixjcpxipxjh.px=kVkxl,Vkx—volume of the minimum hypersphere with its centre at point x containing at least k observations
fori←1 to l do
       Vix ∈ x(1)…x(i − 1)|d(x(i), x) ⩽ dk(x(i))
       Ciy(x)|x ∈ Vi
       ifCi = ∅ then
              generate new cluster c
              y(i)← c
       if|Ci| = 1 then
              let Ci = {c}
              ifcompleted(c) then
                     yi← noise
              else
                     yic
       ifCi>1 then
              let {Ci = c1, …, ct}
              ifcompleted(cj)∀j then
                     yi← noise
       Sic ∈ Ci|cissignificant(h)
       if|Si| > 1 then
              completed(c)← True ∀c ∈ Si
              y(x)← noise ∀x ∈ c ∈ CiSi
              yi← noise
       else
              merge all clusters from Ci and update labels in merged clusters
return y