Skip to content

Commit a6035f7

Browse files
committed
more documentation on python api
1 parent 7e388e3 commit a6035f7

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

python/src/deglib/graph.py

+17-7
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ def get_entry_vertex_indices(self) -> List[int]:
109109
def has_path(self, entry_vertex_indices: List[int], to_vertex: int, eps: float, k: int) -> List[ObjectDistance]:
110110
"""
111111
Returns a path from one of the entry vertex indices to the given to_vertex.
112+
113+
:param entry_vertex_indices: List of start vertices
114+
:param to_vertex: The vertex to find a path to
115+
:param eps: Controls how many nodes are checked during search. Lower eps values like 0.001 are faster but less
116+
accurate. Higher eps values like 0.1 are slower but more accurate. Should always be greater 0.
112117
"""
113118
raise NotImplementedError()
114119

@@ -126,15 +131,19 @@ def search(
126131
extended the search range.
127132
128133
:param query: A feature vector for which similar feature vectors should searched.
129-
:param eps: TODO
134+
:param eps: Controls how many nodes are checked during search. Lower eps values like 0.001 are faster but less
135+
accurate. Higher eps values like 0.1 are slower but more accurate. Should always be greater 0.
130136
:param k: The number of results that will be returned
131137
:param max_distance_computation_count: Limit the number of distance calculations. If set to 0 this is ignored.
132138
:param entry_vertex_indices: Start point for exploratory search. If None, a reasonable default is used.
133139
:param threads: The number of threads to use for parallel processing. It should not excel the number of queries.
134140
If set to 0, the minimum of the number of cores of this machine and the number of queries is
135141
used.
136142
:param thread_batch_size: If threads != 1, the number of queries to search in the same thread.
137-
:returns: TODO
143+
:returns: A tuple containing (indices, distances) where indices is a numpy-array of shape [n_queries, k]
144+
containing the indices to the closest found neighbors to the queries.
145+
Distances is a numpy-array of shape [n_queries, k] containing the distances to the closest found
146+
neighbors.
138147
"""
139148
# handle query shapes
140149
if len(query.shape) == 1:
@@ -160,11 +169,11 @@ def search(
160169
@abstractmethod
161170
def explore(self, entry_vertex_index: int, k: int, max_distance_computation_count: int) -> ResultSet:
162171
"""
163-
A exploration for similar element, limited by max_distance_computation_count
172+
An exploration for similar element, limited by max_distance_computation_count
164173
165174
:param entry_vertex_index: The start point for which similar feature vectors should be searched
166175
:param k: The number of similar feature vectors to return
167-
:param max_distance_computation_count: TODO
176+
:param max_distance_computation_count: Limit the number of distance calculations. If set to 0 this is ignored.
168177
"""
169178
raise NotImplementedError()
170179

@@ -217,7 +226,6 @@ def get_feature_space(self) -> FloatSpace:
217226
# first two parameters get ignored
218227
return FloatSpace(float_space_cpp=self.graph_cpp.get_feature_space())
219228

220-
221229
def get_internal_index(self, external_label: int) -> int:
222230
"""
223231
Translates internal index to external label
@@ -233,7 +241,8 @@ def has_path(self, entry_vertex_indices: List[int], to_vertex: int, eps: float,
233241
234242
:param entry_vertex_indices: List of start vertices
235243
:param to_vertex: The vertex to find a path to
236-
:param eps: TODO
244+
:param eps: Controls how many nodes are checked during search. Lower eps values like 0.001 are faster but less
245+
accurate. Higher eps values like 0.1 are slower but more accurate. Should always be greater 0.
237246
:param k: TODO
238247
"""
239248
return [ObjectDistance(od) for od in self.graph_cpp.has_path(entry_vertex_indices, to_vertex, eps, k)]
@@ -465,7 +474,8 @@ def has_path(self, entry_vertex_indices: List[int], to_vertex: int, eps: float,
465474
466475
:param entry_vertex_indices: List of start vertices
467476
:param to_vertex: The vertex to find a path to
468-
:param eps: TODO
477+
:param eps: Controls how many nodes are checked during search. Lower eps values like 0.001 are faster but less
478+
accurate. Higher eps values like 0.1 are slower but more accurate. Should always be greater 0.
469479
:param k: TODO
470480
"""
471481
return [ObjectDistance(od) for od in self.graph_cpp.has_path(entry_vertex_indices, to_vertex, eps, k)]

0 commit comments

Comments
 (0)