-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Graph logic is now abstracted away from DEG implementation.
- Loading branch information
Ralph Gasser
committed
May 6, 2024
1 parent
170b996
commit ec780fe
Showing
4 changed files
with
255 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...kotlin/org/vitrivr/cottontail/dbms/index/diskann/graph/InMemoryDynamicExplorationGraph.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.vitrivr.cottontail.dbms.index.diskann.graph | ||
|
||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap | ||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap | ||
import org.vitrivr.cottontail.utilities.graph.Graph | ||
import org.vitrivr.cottontail.utilities.graph.memory.InMemoryGraph | ||
|
||
/** | ||
* | ||
*/ | ||
class InMemoryDynamicExplorationGraph<I,V>(degree: Int, private val df: (V, V) -> Double): AbstractDynamicExplorationGraph<I,V>(degree, InMemoryGraph(degree)) { | ||
private val vectors = Object2ObjectOpenHashMap<I,V>() | ||
override fun size(): Long = this.graph.size() | ||
override fun distance(a: V, b: V): Double = this.df(a, b) | ||
override fun loadVector(identifier: I): V = this.vectors[identifier] ?: throw NoSuchElementException("Could not find vector for identifier $identifier") | ||
override fun storeVector(identifier: I, vector: V) { | ||
this.vectors[identifier] = vector | ||
} | ||
} |
Oops, something went wrong.