Skip to content

Commit 93351a9

Browse files
committed
dbscan(): allow eps=0
it just means exact match, nntree-based impl allows it
1 parent 324c9b4 commit 93351a9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/dbscan.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function dbscan(D::AbstractMatrix{T}, eps::Real, minpts::Int) where T<:Real
5454
n = size(D, 1)
5555
size(D, 2) == n || throw(ArgumentError("D must be a square matrix ($(size(D)) given)."))
5656
n >= 2 || throw(ArgumentError("At least two data points are required ($n given)."))
57-
eps > 0 || throw(ArgumentError("eps must be a positive value ($eps given)."))
57+
eps >= 0 || throw(ArgumentError("eps must be a positive value ($eps given)."))
5858
minpts >= 1 || throw(ArgumentError("minpts must be positive integer ($minpts given)."))
5959

6060
# invoke core algorithm

test/dbscan.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ include("test_helpers.jl")
99
Random.seed!(34568)
1010
@test_throws ArgumentError dbscan(randn(2, 3), 1.0, 1)
1111
@test_throws ArgumentError dbscan(randn(1, 1), 1.0, 1)
12-
@test_throws ArgumentError dbscan(randn(2, 2), 0.0, 1)
12+
@test_throws ArgumentError dbscan(randn(2, 2), -1.0, 1)
1313
@test_throws ArgumentError dbscan(randn(2, 2), 1.0, 0)
1414
@test dbscan(randn(2, 2), 0.5, 1) isa DbscanResult
1515
end

0 commit comments

Comments
 (0)