Skip to content

Commit 3f66571

Browse files
committed
Add algo parameters to estimate endpoints
1 parent 2638d30 commit 3f66571

31 files changed

+596
-66
lines changed

graphdatascience/procedure_surface/api/articlerank_endpoints.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,44 @@ def write(
258258
"""
259259

260260
@abstractmethod
261-
def estimate(self, G: Union[Graph, dict[str, Any]]) -> EstimationResult:
261+
def estimate(
262+
self,
263+
G: Union[Graph, dict[str, Any]],
264+
damping_factor: Optional[float] = None,
265+
tolerance: Optional[float] = None,
266+
max_iterations: Optional[int] = None,
267+
scaler: Optional[Any] = None,
268+
relationship_types: Optional[List[str]] = None,
269+
node_labels: Optional[List[str]] = None,
270+
concurrency: Optional[Any] = None,
271+
relationship_weight_property: Optional[str] = None,
272+
source_nodes: Optional[Any] = None,
273+
) -> EstimationResult:
262274
"""
263-
Returns an estimation of the memory consumption for that procedure.
275+
Estimate the memory consumption of an algorithm run.
264276
265277
Parameters
266278
----------
267279
G : Union[Graph, dict[str, Any]]
268280
The graph to run the algorithm on or a dictionary representing the graph.
281+
damping_factor : Optional[float], default=None
282+
The damping factor controls the probability of a random jump to a random node
283+
tolerance : Optional[float], default=None
284+
Minimum change in scores between iterations
285+
max_iterations : Optional[int], default=None
286+
The maximum number of iterations to run
287+
scaler : Optional[Any], default=None
288+
Configuration for scaling the scores
289+
relationship_types : Optional[List[str]], default=None
290+
The relationships types used to select relationships for this algorithm run
291+
node_labels : Optional[List[str]], default=None
292+
The node labels used to select nodes for this algorithm run
293+
concurrency : Optional[Any], default=None
294+
The number of concurrent threads
295+
relationship_weight_property : Optional[str], default=None
296+
The property name that contains weight
297+
source_nodes : Optional[Any], default=None
298+
The source nodes for personalized ArticleRank
269299
270300
Returns
271301
-------

graphdatascience/procedure_surface/api/articulationpoints_endpoints.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,7 @@ def estimate(
194194
concurrency: Optional[Any] = None,
195195
) -> EstimationResult:
196196
"""
197-
Estimate the memory consumption of the Articulation Points algorithm.
198-
199-
This method provides an estimate of the memory requirements for running the algorithm
200-
on a given graph, helping with capacity planning and resource allocation.
197+
Estimate the memory consumption of an algorithm run.
201198
202199
Parameters
203200
----------

graphdatascience/procedure_surface/api/betweenness_endpoints.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,19 +222,40 @@ def write(
222222
"""
223223

224224
@abstractmethod
225-
def estimate(self, G: Union[Graph, dict[str, Any]]) -> EstimationResult:
225+
def estimate(
226+
self,
227+
G: Union[Graph, dict[str, Any]],
228+
sampling_size: Optional[int] = None,
229+
sampling_seed: Optional[int] = None,
230+
relationship_types: Optional[List[str]] = None,
231+
node_labels: Optional[List[str]] = None,
232+
concurrency: Optional[Any] = None,
233+
relationship_weight_property: Optional[str] = None,
234+
) -> EstimationResult:
226235
"""
227236
Estimate the memory consumption of an algorithm run.
228237
229238
Parameters
230239
----------
231240
G : Union[Graph, dict[str, Any]]
232241
The graph to run the algorithm on or a dictionary representing the graph.
242+
sampling_size : Optional[int], default=None
243+
The number of nodes to use for sampling.
244+
sampling_seed : Optional[int], default=None
245+
The seed value for sampling randomization
246+
relationship_types : Optional[List[str]], default=None
247+
The relationship types used to select relationships for this algorithm run
248+
node_labels : Optional[List[str]], default=None
249+
The node labels used to select nodes for this algorithm run
250+
concurrency : Optional[Any], default=None
251+
The number of concurrent threads
252+
relationship_weight_property : Optional[str], default=None
253+
The property name that contains weight
233254
234255
Returns
235256
-------
236257
EstimationResult
237-
An object containing the result of the estimation
258+
Memory estimation details
238259
"""
239260

240261

graphdatascience/procedure_surface/api/celf_endpoints.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ def write(
244244
"""
245245
pass
246246

247-
# TODO add for params for estimate in other endpoints as well (missed before)
248247
@abstractmethod
249248
def estimate(
250249
self,
@@ -258,10 +257,7 @@ def estimate(
258257
concurrency: Optional[Any] = None,
259258
) -> EstimationResult:
260259
"""
261-
Estimate the memory consumption of the CELF algorithm.
262-
263-
This method provides an estimate of the memory requirements for running the algorithm
264-
on a given graph, helping with capacity planning and resource allocation.
260+
Estimate the memory consumption of an algorithm run.
265261
266262
Parameters
267263
----------

graphdatascience/procedure_surface/api/degree_endpoints.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,24 +242,38 @@ def write(
242242
pass
243243

244244
@abstractmethod
245-
def estimate(self, G: Union[Graph, dict[str, Any]]) -> EstimationResult:
245+
def estimate(
246+
self,
247+
G: Union[Graph, dict[str, Any]],
248+
orientation: Optional[Any] = None,
249+
relationship_types: Optional[List[str]] = None,
250+
node_labels: Optional[List[str]] = None,
251+
concurrency: Optional[Any] = None,
252+
relationship_weight_property: Optional[str] = None,
253+
) -> EstimationResult:
246254
"""
247-
Estimate the memory consumption of the Degree Centrality algorithm.
248-
249-
This method provides an estimate of the memory requirements for running the algorithm
250-
on a given graph, helping with capacity planning and resource allocation.
255+
Estimate the memory consumption of an algorithm run.
251256
252257
Parameters
253258
----------
254259
G : Union[Graph, dict[str, Any]]
255260
The graph to run the algorithm on or a dictionary representing the graph.
261+
orientation : Optional[Any], default=None
262+
The orientation of relationships to consider. Can be 'NATURAL', 'REVERSE', or 'UNDIRECTED'.
263+
relationship_types : Optional[List[str]], default=None
264+
The relationship types used to select relationships for this algorithm run
265+
node_labels : Optional[List[str]], default=None
266+
The node labels used to select nodes for this algorithm run
267+
concurrency : Optional[Any], default=None
268+
The number of concurrent threads
269+
relationship_weight_property : Optional[str], default=None
270+
The property name that contains weight
256271
257272
Returns
258273
-------
259274
EstimationResult
260-
An object containing the result of the estimation including memory requirements
275+
Memory estimation details
261276
"""
262-
pass
263277

264278

265279
class DegreeMutateResult(BaseResult):

graphdatascience/procedure_surface/api/eigenvector_endpoints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def estimate(
271271
concurrency: Optional[Any] = None,
272272
) -> EstimationResult:
273273
"""
274-
Estimate the memory consumption of an Eigenvector Centrality algorithm run.
274+
Estimate the memory consumption of an algorithm run.
275275
276276
Parameters
277277
----------

graphdatascience/procedure_surface/api/k1coloring_endpoints.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,19 +220,37 @@ def write(
220220
pass
221221

222222
@abstractmethod
223-
def estimate(self, G: Union[Graph, dict[str, Any]]) -> EstimationResult:
223+
def estimate(
224+
self,
225+
G: Union[Graph, dict[str, Any]],
226+
batch_size: Optional[int] = None,
227+
max_iterations: Optional[int] = None,
228+
relationship_types: Optional[List[str]] = None,
229+
node_labels: Optional[List[str]] = None,
230+
concurrency: Optional[Any] = None,
231+
) -> EstimationResult:
224232
"""
225233
Estimate the memory consumption of an algorithm run.
226234
227235
Parameters
228236
----------
229237
G : Union[Graph, dict[str, Any]]
230238
The graph to run the algorithm on or a dictionary representing the graph.
239+
batch_size : Optional[int], default=None
240+
The batch size for processing
241+
max_iterations : Optional[int], default=None
242+
The maximum number of iterations of K-1 Coloring to run
243+
relationship_types : Optional[List[str]], default=None
244+
The relationship types used to select relationships for this algorithm run
245+
node_labels : Optional[List[str]], default=None
246+
The node labels used to select nodes for this algorithm run
247+
concurrency : Optional[Any], default=None
248+
The number of concurrent threads
231249
232250
Returns
233251
-------
234252
EstimationResult
235-
An object containing the result of the estimation
253+
Memory estimation details
236254
"""
237255
pass
238256

graphdatascience/procedure_surface/api/kcore_endpoints.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,19 +196,31 @@ def write(
196196
pass
197197

198198
@abstractmethod
199-
def estimate(self, G: Union[Graph, dict[str, Any]]) -> EstimationResult:
199+
def estimate(
200+
self,
201+
G: Union[Graph, dict[str, Any]],
202+
relationship_types: Optional[List[str]] = None,
203+
node_labels: Optional[List[str]] = None,
204+
concurrency: Optional[Any] = None,
205+
) -> EstimationResult:
200206
"""
201207
Estimate the memory consumption of an algorithm run.
202208
203209
Parameters
204210
----------
205211
G : Union[Graph, dict[str, Any]]
206212
The graph to run the algorithm on or a dictionary representing the graph.
213+
relationship_types : Optional[List[str]], default=None
214+
The relationship types used to select relationships for this algorithm run
215+
node_labels : Optional[List[str]], default=None
216+
The node labels used to select nodes for this algorithm run
217+
concurrency : Optional[Any], default=None
218+
The number of concurrent threads
207219
208220
Returns
209221
-------
210222
EstimationResult
211-
An object containing the result of the estimation
223+
Memory estimation details
212224
"""
213225
pass
214226

graphdatascience/procedure_surface/api/louvain_endpoints.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,47 @@ def write(
280280
pass
281281

282282
@abstractmethod
283-
def estimate(self, G: Union[Graph, dict[str, Any]]) -> EstimationResult:
283+
def estimate(
284+
self,
285+
G: Union[Graph, dict[str, Any]],
286+
tolerance: Optional[float] = None,
287+
max_levels: Optional[int] = None,
288+
include_intermediate_communities: Optional[bool] = None,
289+
max_iterations: Optional[int] = None,
290+
relationship_types: Optional[List[str]] = None,
291+
node_labels: Optional[List[str]] = None,
292+
concurrency: Optional[Any] = None,
293+
seed_property: Optional[str] = None,
294+
consecutive_ids: Optional[bool] = None,
295+
relationship_weight_property: Optional[str] = None,
296+
) -> EstimationResult:
284297
"""
285298
Estimate the memory consumption of an algorithm run.
286299
287300
Parameters
288301
----------
289302
G : Union[Graph, dict[str, Any]]
290303
The graph to run the algorithm on or a dictionary representing the graph.
304+
tolerance : Optional[float], default=None
305+
The tolerance value for the algorithm convergence
306+
max_levels : Optional[int], default=None
307+
The maximum number of levels in the hierarchy
308+
include_intermediate_communities : Optional[bool], default=None
309+
Whether to include intermediate community assignments
310+
max_iterations : Optional[int], default=None
311+
The maximum number of iterations per level
312+
relationship_types : Optional[List[str]], default=None
313+
The relationship types used to select relationships for this algorithm run
314+
node_labels : Optional[List[str]], default=None
315+
The node labels used to select nodes for this algorithm run
316+
concurrency : Optional[Any], default=None
317+
The number of concurrent threads
318+
seed_property : Optional[str], default=None
319+
A property to use as the starting community id for a node
320+
consecutive_ids : Optional[bool], default=None
321+
Flag to decide if the component identifiers should be returned consecutively or not
322+
relationship_weight_property : Optional[str], default=None
323+
The property name that contains weight
291324
292325
Returns
293326
-------

graphdatascience/procedure_surface/api/pagerank_endpoints.py

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,44 @@ def write(
262262
pass
263263

264264
@abstractmethod
265-
def estimate(self, G: Union[Graph, dict[str, Any]]) -> EstimationResult:
265+
def estimate(
266+
self,
267+
G: Union[Graph, dict[str, Any]],
268+
damping_factor: Optional[float] = None,
269+
tolerance: Optional[float] = None,
270+
max_iterations: Optional[int] = None,
271+
scaler: Optional[Any] = None,
272+
relationship_types: Optional[List[str]] = None,
273+
node_labels: Optional[List[str]] = None,
274+
concurrency: Optional[Any] = None,
275+
relationship_weight_property: Optional[str] = None,
276+
source_nodes: Optional[Any] = None,
277+
) -> EstimationResult:
266278
"""
267-
Estimates the memory requirements for running the PageRank algorithm.
279+
Estimate the memory consumption of an algorithm run.
268280
269281
Parameters
270282
----------
271283
G : Union[Graph, dict[str, Any]]
272284
The graph to run the algorithm on or a dictionary representing the graph.
285+
damping_factor : Optional[float], default=None
286+
The damping factor controls the probability of a random jump to a random node
287+
tolerance : Optional[float], default=None
288+
Minimum change in scores between iterations
289+
max_iterations : Optional[int], default=None
290+
The maximum number of iterations to run
291+
scaler : Optional[Any], default=None
292+
Configuration for scaling the scores
293+
relationship_types : Optional[List[str]], default=None
294+
The relationships types used to select relationships for this algorithm run
295+
node_labels : Optional[List[str]], default=None
296+
The node labels used to select nodes for this algorithm run
297+
concurrency : Optional[Any], default=None
298+
The number of concurrent threads
299+
relationship_weight_property : Optional[str], default=None
300+
The property name that contains weight
301+
source_nodes : Optional[Any], default=None
302+
The source nodes for personalized PageRank
273303
274304
Returns
275305
-------

0 commit comments

Comments
 (0)