Skip to content

Commit

Permalink
HNSW Doc (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekzhu authored Sep 6, 2023
1 parent 9827f2f commit e8d1cfa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions datasketch/hnsw.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ def __init__(
def __len__(self) -> int:
return len(self._data)

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

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

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

0 comments on commit e8d1cfa

Please sign in to comment.