Skip to main content
. 2023 Feb 13;23(4):2096. doi: 10.3390/s23042096
Algorithm 1: DBSCAN algorithm pseudo-code
Input: Sample set D={x1,x2,,xm}, neighborhood parameters (Eps,Minpts)
Workflow:
Initializing the core object set: Ω=;
forj = 1, 2……, m
   Determine the number of samples NEps(xj) in the Eps-neighborhood of sample xj;
   if NEps(xj)Minpts
     Put sample xj into the core sample set: Ω=Ω{xj};
   end if
end for
Initialize the number of clusters: k=0;
Initialize the set of unaccessed samples: Γ=D;
whileΩ
     Sample sets not currently being accessed:Γold=Γ;
     Randomly select core objects cΩ, initializing the queue Q=c;
     Γ = Γ  \ {c};
     While Q
       Take the first sample q from the queue Q
       if NEps(xj)Minpts
          Make Δ=NEps(q)Γ,
          Put all elements of Δ into the queue Q;
          Γ = Γ \ Δ;
       end if
    end while
    k = k + 1, generate clusters Ck=Γold \ Γ;
    Ω=Ω\Ck
end while
Output: cluster classification C={C1,C2,,Ck};