Skip to content

Commit

Permalink
dbscan(): only create clusters with non-empty core
Browse files Browse the repository at this point in the history
fixes #200
  • Loading branch information
alyst committed Mar 22, 2023
1 parent 47d417f commit 6076f16
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/dbscan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,10 @@ function _dbscan(kdtree::KDTree, points::AbstractMatrix, radius::Real;
core_selection[current_index] = true
update_exploration_list!(adj_list, to_explore, visited)
end
cluster_size = sum(cluster_selection)
min_cluster_size <= cluster_size && accept_cluster!(clusters, core_selection, cluster_selection, cluster_size)
if any(core_selection) &&
(cluster_size = sum(cluster_selection)) >= min_cluster_size
accept_cluster!(clusters, core_selection, cluster_selection, cluster_size)
end
end
return clusters
end
Expand Down

0 comments on commit 6076f16

Please sign in to comment.