Skip to content

Commit e8d1cfa

Browse files
authored
HNSW Doc (#222)
1 parent 9827f2f commit e8d1cfa

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

datasketch/hnsw.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ def __init__(
117117
def __len__(self) -> int:
118118
return len(self._data)
119119

120-
def __contains__(self, key) -> bool:
120+
def __contains__(self, key: Any) -> bool:
121121
return key in self._data
122122

123-
def __getitem__(self, key) -> np.ndarray:
123+
def __getitem__(self, key: Any) -> np.ndarray:
124124
"""Get the point associated with the key."""
125125
return self._data[key]
126126

@@ -152,7 +152,8 @@ def insert(
152152
"""Add a new point to the index.
153153
154154
Args:
155-
key (Any): The key of the new point.
155+
key (Any): The key of the new point. If the key already exists in the
156+
index, the point will be updated and the index will be repaired.
156157
new_point (np.ndarray): The new point to add to the index.
157158
ef (Optional[int]): The number of neighbors to consider during insertion.
158159
level (Optional[int]): The level at which to insert the new point.

0 commit comments

Comments
 (0)