Skip to content

Commit 027b508

Browse files
committed
Inline default for community endpoints part 1
1 parent 87b5d57 commit 027b508

22 files changed

+779
-749
lines changed

graphdatascience/procedure_surface/api/community/clique_counting_endpoints.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def mutate(
2222
log_progress: bool = True,
2323
node_labels: list[str] = ALL_LABELS,
2424
relationship_types: list[str] = ALL_TYPES,
25-
sudo: bool | None = False,
25+
sudo: bool = False,
2626
username: str | None = None,
2727
) -> CliqueCountingMutateResult:
2828
"""
@@ -44,7 +44,7 @@ def mutate(
4444
The node labels used to select nodes for this algorithm run
4545
relationship_types : list[str]
4646
The relationship types used to select relationships for this algorithm run
47-
sudo : bool | None, default=False
47+
sudo : bool, default=False
4848
Override memory estimation limits
4949
username : str | None, default=None
5050
The username to attribute the procedure run to

graphdatascience/procedure_surface/api/community/k1coloring_endpoints.py

Lines changed: 95 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,16 @@ def mutate(
2121
self,
2222
G: GraphV2,
2323
mutate_property: str,
24-
batch_size: int | None = None,
25-
max_iterations: int | None = None,
26-
relationship_types: list[str] = ALL_TYPES,
27-
node_labels: list[str] = ALL_LABELS,
28-
sudo: bool | None = None,
24+
*,
25+
batch_size: int = 10000,
26+
concurrency: int | None = None,
27+
job_id: str | None = None,
2928
log_progress: bool = True,
29+
max_iterations: int = 10,
30+
node_labels: list[str] = ALL_LABELS,
31+
relationship_types: list[str] = ALL_TYPES,
32+
sudo: bool = False,
3033
username: str | None = None,
31-
concurrency: Any | None = None,
32-
job_id: Any | None = None,
3334
) -> K1ColoringMutateResult:
3435
"""
3536
Executes the K-1 Coloring algorithm and writes the results to the in-memory graph as node properties.
@@ -40,24 +41,24 @@ def mutate(
4041
The graph to run the algorithm on
4142
mutate_property : str
4243
The property name to store the color for each node
43-
batch_size : int | None, default=None
44+
batch_size : int, default=10000
4445
The batch size for processing
45-
max_iterations : int
46+
concurrency : int | None, default=None
47+
The number of concurrent threads
48+
job_id : str | None, default=None
49+
An identifier for the job
50+
log_progress : bool, default=True
51+
Whether to log progress
52+
max_iterations : int, default=10
4653
The maximum number of iterations of K-1 Coloring to run
47-
relationship_types : list[str]
48-
The relationships types used to select relationships for this algorithm run
4954
node_labels : list[str]
5055
The node labels used to select nodes for this algorithm run
51-
sudo : bool
56+
relationship_types : list[str]
57+
The relationship types used to select relationships for this algorithm run
58+
sudo : bool, default=False
5259
Override memory estimation limits
53-
log_progress : bool | None, default=None
54-
Whether to log progress
5560
username : str | None, default=None
5661
The username to attribute the procedure run to
57-
concurrency : Any | None, default=None
58-
The number of concurrent threads
59-
job_id : Any | None, default=None
60-
An identifier for the job
6162
6263
Returns
6364
-------
@@ -70,15 +71,16 @@ def mutate(
7071
def stats(
7172
self,
7273
G: GraphV2,
73-
batch_size: int | None = None,
74-
max_iterations: int | None = None,
75-
relationship_types: list[str] = ALL_TYPES,
76-
node_labels: list[str] = ALL_LABELS,
77-
sudo: bool | None = None,
74+
*,
75+
batch_size: int = 10000,
76+
concurrency: int | None = None,
77+
job_id: str | None = None,
7878
log_progress: bool = True,
79+
max_iterations: int = 10,
80+
node_labels: list[str] = ALL_LABELS,
81+
relationship_types: list[str] = ALL_TYPES,
82+
sudo: bool = False,
7983
username: str | None = None,
80-
concurrency: Any | None = None,
81-
job_id: Any | None = None,
8284
) -> K1ColoringStatsResult:
8385
"""
8486
Executes the K-1 Coloring algorithm and returns statistics.
@@ -87,24 +89,24 @@ def stats(
8789
----------
8890
G : GraphV2
8991
The graph to run the algorithm on
90-
batch_size : int | None, default=None
92+
batch_size : int, default=10000
9193
The batch size for processing
92-
max_iterations : int
94+
concurrency : int | None, default=None
95+
The number of concurrent threads
96+
job_id : str | None, default=None
97+
An identifier for the job
98+
log_progress : bool, default=True
99+
Whether to log progress
100+
max_iterations : int, default=10
93101
The maximum number of iterations of K-1 Coloring to run
94-
relationship_types : list[str]
95-
The relationships types used to select relationships for this algorithm run
96102
node_labels : list[str]
97103
The node labels used to select nodes for this algorithm run
98-
sudo : bool
104+
relationship_types : list[str]
105+
The relationship types used to select relationships for this algorithm run
106+
sudo : bool, default=False
99107
Override memory estimation limits
100-
log_progress : bool | None, default=None
101-
Whether to log progress
102108
username : str | None, default=None
103109
The username to attribute the procedure run to
104-
concurrency : Any | None, default=None
105-
The number of concurrent threads
106-
job_id : Any | None, default=None
107-
An identifier for the job
108110
109111
Returns
110112
-------
@@ -117,16 +119,17 @@ def stats(
117119
def stream(
118120
self,
119121
G: GraphV2,
120-
batch_size: int | None = None,
121-
max_iterations: int | None = None,
122-
relationship_types: list[str] = ALL_TYPES,
123-
node_labels: list[str] = ALL_LABELS,
124-
sudo: bool | None = None,
122+
*,
123+
batch_size: int = 10000,
124+
concurrency: int | None = None,
125+
job_id: str | None = None,
125126
log_progress: bool = True,
126-
username: str | None = None,
127-
concurrency: Any | None = None,
128-
job_id: Any | None = None,
127+
max_iterations: int = 10,
129128
min_community_size: int | None = None,
129+
node_labels: list[str] = ALL_LABELS,
130+
relationship_types: list[str] = ALL_TYPES,
131+
sudo: bool = False,
132+
username: str | None = None,
130133
) -> DataFrame:
131134
"""
132135
Executes the K-1 Coloring algorithm and returns a stream of results.
@@ -135,26 +138,26 @@ def stream(
135138
----------
136139
G : GraphV2
137140
The graph to run the algorithm on
138-
batch_size : int | None, default=None
141+
batch_size : int, default=10000
139142
The batch size for processing
140-
max_iterations : int
143+
concurrency : int | None, default=None
144+
The number of concurrent threads
145+
job_id : str | None, default=None
146+
An identifier for the job
147+
log_progress : bool, default=True
148+
Whether to log progress
149+
max_iterations : int, default=10
141150
The maximum number of iterations of K-1 Coloring to run
142-
relationship_types : list[str]
143-
The relationships types considered in this algorithm run
151+
min_community_size : int | None, default=None
152+
Only community ids of communities with a size greater than or equal to the given value are returned
144153
node_labels : list[str]
145154
The node labels used to select nodes for this algorithm run
146-
sudo : bool
155+
relationship_types : list[str]
156+
The relationship types considered in this algorithm run
157+
sudo : bool, default=False
147158
Override memory estimation limits
148-
log_progress : bool | None, default=None
149-
Whether to log progress
150159
username : str | None, default=None
151160
The username to attribute the procedure run to
152-
concurrency : Any | None, default=None
153-
The number of concurrent threads
154-
job_id : Any | None, default=None
155-
An identifier for the job
156-
min_community_size : int | None, default=None
157-
Only community ids of communities with a size greater than or equal to the given value are returned
158161
159162
Returns
160163
-------
@@ -168,17 +171,18 @@ def write(
168171
self,
169172
G: GraphV2,
170173
write_property: str,
171-
batch_size: int | None = None,
172-
max_iterations: int | None = None,
173-
relationship_types: list[str] = ALL_TYPES,
174-
node_labels: list[str] = ALL_LABELS,
175-
sudo: bool | None = None,
174+
*,
175+
batch_size: int = 10000,
176+
concurrency: int | None = None,
177+
job_id: str | None = None,
176178
log_progress: bool = True,
177-
username: str | None = None,
178-
concurrency: Any | None = None,
179-
job_id: Any | None = None,
180-
write_concurrency: Any | None = None,
179+
max_iterations: int = 10,
181180
min_community_size: int | None = None,
181+
node_labels: list[str] = ALL_LABELS,
182+
relationship_types: list[str] = ALL_TYPES,
183+
sudo: bool = False,
184+
username: str | None = None,
185+
write_concurrency: int | None = None,
182186
) -> K1ColoringWriteResult:
183187
"""
184188
Executes the K-1 Coloring algorithm and writes the results to the Neo4j database.
@@ -189,28 +193,28 @@ def write(
189193
The graph to run the algorithm on
190194
write_property : str
191195
The property name to write colors to
192-
batch_size : int | None, default=None
196+
batch_size : int, default=10000
193197
The batch size for processing
194-
max_iterations : int
198+
concurrency : int | None, default=None
199+
The number of concurrent threads
200+
job_id : str | None, default=None
201+
An identifier for the job
202+
log_progress : bool, default=True
203+
Whether to log progress
204+
max_iterations : int, default=10
195205
The maximum number of iterations of K-1 Coloring to run
196-
relationship_types : list[str]
197-
The relationships types considered in this algorithm run
206+
min_community_size : int | None, default=None
207+
Only community ids of communities with a size greater than or equal to the given value are written to Neo4j
198208
node_labels : list[str]
199209
The node labels used to select nodes for this algorithm run
200-
sudo : bool
210+
relationship_types : list[str]
211+
The relationship types considered in this algorithm run
212+
sudo : bool, default=False
201213
Override memory estimation limits
202-
log_progress : bool | None, default=None
203-
Whether to log progress
204214
username : str | None, default=None
205215
The username to attribute the procedure run to
206-
concurrency : Any | None, default=None
207-
The number of concurrent threads
208-
job_id : Any | None, default=None
209-
An identifier for the job
210-
write_concurrency : Any | None, default=None
216+
write_concurrency : int | None, default=None
211217
The number of concurrent threads during the write phase
212-
min_community_size : int | None, default=None
213-
Only community ids of communities with a size greater than or equal to the given value are written to Neo4j
214218
215219
Returns
216220
-------
@@ -223,11 +227,12 @@ def write(
223227
def estimate(
224228
self,
225229
G: GraphV2 | dict[str, Any],
226-
batch_size: int | None = None,
227-
max_iterations: int | None = None,
228-
relationship_types: list[str] = ALL_TYPES,
230+
*,
231+
batch_size: int = 10000,
232+
concurrency: int | None = None,
233+
max_iterations: int = 10,
229234
node_labels: list[str] = ALL_LABELS,
230-
concurrency: Any | None = None,
235+
relationship_types: list[str] = ALL_TYPES,
231236
) -> EstimationResult:
232237
"""
233238
Estimate the memory consumption of an algorithm run.
@@ -236,16 +241,16 @@ def estimate(
236241
----------
237242
G : GraphV2 | dict[str, Any]
238243
The graph to run the algorithm on or a dictionary representing the graph.
239-
batch_size : int | None, default=None
244+
batch_size : int, default=10000
240245
The batch size for processing
241-
max_iterations : int
246+
concurrency : int | None, default=None
247+
The number of concurrent threads
248+
max_iterations : int, default=10
242249
The maximum number of iterations of K-1 Coloring to run
243-
relationship_types : list[str]
244-
The relationship types used to select relationships for this algorithm run
245250
node_labels : list[str]
246251
The node labels used to select nodes for this algorithm run
247-
concurrency : Any | None, default=None
248-
The number of concurrent threads
252+
relationship_types : list[str]
253+
The relationship types used to select relationships for this algorithm run
249254
250255
Returns
251256
-------

0 commit comments

Comments
 (0)