Skip to content

Commit 89d8090

Browse files
committed
Update DataStructures to 0.18; Bump minor version 0.3.2
1 parent 271c0b1 commit 89d8090

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "NearestNeighborDescent"
22
uuid = "dd2c4c9e-a32f-5b2f-b342-08c2f244fce8"
33
authors = ["Dillon Daudert <dillongdaudert@gmail.com>"]
4-
version = "0.3.1"
4+
version = "0.3.2"
55

66
[deps]
77
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
@@ -12,7 +12,7 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
1212
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1313

1414
[compat]
15-
DataStructures = "0.15, 0.17"
15+
DataStructures = "0.18"
1616
Distances = "0.8, 0.9"
1717
LightGraphs = "1.3"
1818
Reexport = "0.2"

src/knn_graph/heap_graph.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,12 @@ complexity of `𝒪(K)`.
197197
198198
Try to add an edge `e`, indicating a new candidate nearest neighbor `e.dest` for
199199
vertex `e.src`, by pushing onto `e.src`'s heap. This will fail (return `false`) if
200-
`e` is already in the heap or if `e.weight > top(heap).weight`. Otherwise return `true`.
200+
`e` is already in the heap or if `e.weight > first(heap).weight`. Otherwise return `true`.
201201
"""
202202
function LightGraphs.add_edge!(g::HeapKNNGraph, e::HeapKNNGraphEdge)
203203
# NOTE we can assume the invariants for heap knn graphs hold
204-
if e < top(g.heaps[src(e)]) && !has_edge(g, src(e), dst(e))
205-
# we know this edge is smaller than the top, so we can start by removing that
204+
if e < first(g.heaps[src(e)]) && !has_edge(g, src(e), dst(e))
205+
# we know this edge is smaller than the first, so we can start by removing that
206206
pop!(g.heaps[src(e)])
207207
push!(g.heaps[src(e)], e)
208208
return true
@@ -217,7 +217,7 @@ end
217217
Return the diameter of the set of KNNs of vertex `v`.
218218
"""
219219
function knn_diameter(g::Union{HeapKNNGraph{V}, LockHeapKNNGraph{V}}, v::V) where V
220-
return 2 * weight(top(g.heaps[v]))
220+
return 2 * weight(first(g.heaps[v]))
221221
end
222222

223223
"""

src/knn_graph/threaded_heap_graph.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ Similar to `add_edge!(g::HeapKNNGraph, e)`, but made thread-safe using locks.
108108
function LightGraphs.add_edge!(g::LockHeapKNNGraph, e::HeapKNNGraphEdge)
109109
# NOTE we can assume the invariants for heap knn graphs hold
110110
lock(g.locks[src(e)]) do
111-
if e < top(g.heaps[src(e)]) && !has_edge(g, src(e), dst(e))
112-
# we know this edge is smaller than the top, so we can start by removing that
111+
if e < first(g.heaps[src(e)]) && !has_edge(g, src(e), dst(e))
112+
# we know this edge is smaller than the first, so we can start by removing that
113113
pop!(g.heaps[src(e)])
114114
push!(g.heaps[src(e)], e)
115115
return true

test/knn_graph/utils_tests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@
6464

6565
KNNGraphs._heappush!(h, e, 1)
6666
@test length(h) == 1
67-
@test top(h) == e
67+
@test first(h) == e
6868

6969
e2 = HeapKNNGraphEdge(1, 3, 1.) # new point, heappush! just replaces
7070
KNNGraphs._heappush!(h, e2, 1)
7171
@test length(h) == 1
72-
@test top(h) == e2
72+
@test first(h) == e2
7373
end
7474
end
7575
end # end utilities tests

0 commit comments

Comments
 (0)