Skip to content

Commit 3f68114

Browse files
committed
Centrality stats/write docstrings
1 parent ea11206 commit 3f68114

File tree

9 files changed

+90
-18
lines changed

9 files changed

+90
-18
lines changed

graphdatascience/procedure_surface/api/centrality/articlerank_endpoints.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ def stats(
100100
source_nodes: Optional[Any] = None,
101101
) -> ArticleRankStatsResult:
102102
"""
103-
Executes the ArticleRank algorithm and returns result statistics without writing the result to Neo4j.
103+
Runs the Article Rank algorithm and returns result statistics without storing the results.
104+
105+
ArticleRank is a variant of the Page Rank algorithm, which measures the transitive influence of nodes.
106+
Page Rank follows the assumption that relationships originating from low-degree nodes have a higher influence than relationships from high-degree nodes.
107+
Article Rank lowers the influence of low-degree nodes by lowering the scores being sent to their neighbors in each iteration.
104108
105109
Parameters
106110
----------
@@ -218,7 +222,11 @@ def write(
218222
write_concurrency: Optional[int] = None,
219223
) -> ArticleRankWriteResult:
220224
"""
221-
Executes the ArticleRank algorithm and writes the results to Neo4j.
225+
Runs the Article Rank algorithm and stores the result in the Neo4j database as a new node property.
226+
227+
ArticleRank is a variant of the Page Rank algorithm, which measures the transitive influence of nodes.
228+
Page Rank follows the assumption that relationships originating from low-degree nodes have a higher influence than relationships from high-degree nodes.
229+
Article Rank lowers the influence of low-degree nodes by lowering the scores being sent to their neighbors in each iteration.
222230
223231
Parameters
224232
----------

graphdatascience/procedure_surface/api/centrality/articulationpoints_endpoints.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ def stats(
7373
job_id: Optional[Any] = None,
7474
) -> "ArticulationPointsStatsResult":
7575
"""
76-
Executes the ArticulationPoints algorithm and returns result statistics without writing the result to Neo4j.
76+
Runs the Articulation Points algorithm and returns result statistics without storing the results.
77+
78+
Given a graph, an articulation point is a node whose removal increases the number of connected components in the graph.
79+
The Neo4j GDS Library provides an efficient linear time sequential algorithm to compute all articulation points in a graph.
7780
7881
Parameters
7982
----------
@@ -157,7 +160,10 @@ def write(
157160
write_concurrency: Optional[Any] = None,
158161
) -> "ArticulationPointsWriteResult":
159162
"""
160-
Executes the ArticulationPoints algorithm and writes the results back to the Neo4j database.
163+
Runs the Articulation Points algorithm and stores the result in the Neo4j database as a new node property.
164+
165+
Given a graph, an articulation point is a node whose removal increases the number of connected components in the graph.
166+
The Neo4j GDS Library provides an efficient linear time sequential algorithm to compute all articulation points in a graph.
161167
162168
Parameters
163169
----------

graphdatascience/procedure_surface/api/centrality/betweenness_endpoints.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ def stats(
8989
relationship_weight_property: Optional[str] = None,
9090
) -> BetweennessStatsResult:
9191
"""
92-
Executes the Betweenness Centrality algorithm and returns result statistics without writing the result to Neo4j.
92+
Runs the Betweenness Centrality algorithm and returns result statistics without storing the results.
93+
94+
Betweenness centrality is a way of detecting the amount of influence a node has over the flow of information in a graph.
95+
It is often used to find nodes that serve as a bridge from one part of a graph to another.
96+
The algorithm calculates shortest paths between all pairs of nodes in a graph.
97+
Each node receives a score, based on the number of shortest paths that pass through the node.
9398
9499
Parameters
95100
----------
@@ -189,7 +194,12 @@ def write(
189194
write_concurrency: Optional[Any] = None,
190195
) -> BetweennessWriteResult:
191196
"""
192-
Executes the Betweenness Centrality algorithm and writes the results to the Neo4j database.
197+
Runs the Betweenness Centrality algorithm and stores the result in the Neo4j database as a new node property.
198+
199+
Betweenness centrality is a way of detecting the amount of influence a node has over the flow of information in a graph.
200+
It is often used to find nodes that serve as a bridge from one part of a graph to another.
201+
The algorithm calculates shortest paths between all pairs of nodes in a graph.
202+
Each node receives a score, based on the number of shortest paths that pass through the node.
193203
194204
Parameters
195205
----------

graphdatascience/procedure_surface/api/centrality/celf_endpoints.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ def stats(
9595
job_id: Optional[Any] = None,
9696
) -> CelfStatsResult:
9797
"""
98-
Executes the CELF algorithm and returns statistics without writing the result to Neo4j.
98+
Runs the CELF algorithm and returns result statistics without storing the results.
99+
100+
The influence maximization problem asks for a set of k nodes that maximize the expected spread of influence in the network.
99101
100102
Parameters
101103
----------
@@ -206,7 +208,9 @@ def write(
206208
write_concurrency: Optional[Any] = None,
207209
) -> CelfWriteResult:
208210
"""
209-
Executes the CELF algorithm and writes the results to the Neo4j database.
211+
Runs the CELF algorithm and stores the result in the Neo4j database as a new node property.
212+
213+
The influence maximization problem asks for a set of k nodes that maximize the expected spread of influence in the network.
210214
211215
Parameters
212216
----------

graphdatascience/procedure_surface/api/centrality/closeness_endpoints.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ def stats(
8686
job_id: Optional[Any] = None,
8787
) -> ClosenessStatsResult:
8888
"""
89-
Executes the Closeness Centrality algorithm and returns statistics without writing the result to Neo4j.
89+
Runs the Closeness Centrality algorithm and returns result statistics without storing the results.
90+
91+
Closeness centrality is a way of detecting nodes that are able to spread information very efficiently through a graph.
92+
The closeness centrality of a node measures its average farness (inverse distance) to all other nodes.
93+
Nodes with a high closeness score have the shortest distances to all other nodes.
9094
9195
Parameters
9296
----------
@@ -179,7 +183,11 @@ def write(
179183
write_concurrency: Optional[Any] = None,
180184
) -> ClosenessWriteResult:
181185
"""
182-
Executes the Closeness Centrality algorithm and writes the results to the Neo4j database.
186+
Runs the Closeness Centrality algorithm and stores the result in the Neo4j database as a new node property.
187+
188+
Closeness centrality is a way of detecting nodes that are able to spread information very efficiently through a graph.
189+
The closeness centrality of a node measures its average farness (inverse distance) to all other nodes.
190+
Nodes with a high closeness score have the shortest distances to all other nodes.
183191
184192
Parameters
185193
----------

graphdatascience/procedure_surface/api/centrality/closeness_harmonic_endpoints.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ def stats(
8181
job_id: Optional[Any] = None,
8282
) -> ClosenessHarmonicStatsResult:
8383
"""
84-
Executes the Harmonic Closeness Centrality algorithm and returns statistics without writing the result to Neo4j.
84+
Runs the Harmonic Centrality algorithm and returns result statistics without storing the results.
85+
86+
Harmonic centrality was proposed by Marchiori and Latora while trying to come up with a sensible notion of "average shortest path".
87+
They suggested a different way of calculating the average distance to that used in the Closeness Centrality algorithm.
88+
Rather than summing the distances of a node to all other nodes, the harmonic centrality algorithm sums the inverse of those distances.
89+
This enables it deal with infinite values.
8590
8691
Parameters
8792
----------
@@ -167,7 +172,12 @@ def write(
167172
write_concurrency: Optional[Any] = None,
168173
) -> ClosenessHarmonicWriteResult:
169174
"""
170-
Executes the Harmonic Closeness Centrality algorithm and writes the results to the Neo4j database.
175+
Runs the Harmonic Centrality algorithm and stores the result in the Neo4j database as a new node property.
176+
177+
Harmonic centrality was proposed by Marchiori and Latora while trying to come up with a sensible notion of "average shortest path".
178+
They suggested a different way of calculating the average distance to that used in the Closeness Centrality algorithm.
179+
Rather than summing the distances of a node to all other nodes, the harmonic centrality algorithm sums the inverse of those distances.
180+
This enables it deal with infinite values.
171181
172182
Parameters
173183
----------

graphdatascience/procedure_surface/api/centrality/degree_endpoints.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ def stats(
9696
relationship_weight_property: Optional[str] = None,
9797
) -> DegreeStatsResult:
9898
"""
99-
Executes the Degree Centrality algorithm and returns statistics without writing the result to Neo4j.
99+
Runs the Degree Centrality algorithm and returns result statistics without storing the results.
100+
101+
The Degree Centrality algorithm can be used to find popular nodes within a graph.
102+
The degree centrality measures the number of incoming or outgoing (or both) relationships from a node, which can be defined by the orientation of a relationship projection.
103+
It can be applied to either weighted or unweighted graphs.
104+
In the weighted case the algorithm computes the sum of all positive weights of adjacent relationships of a node, for each node in the graph.
100105
101106
Parameters
102107
----------
@@ -205,7 +210,12 @@ def write(
205210
write_concurrency: Optional[Any] = None,
206211
) -> DegreeWriteResult:
207212
"""
208-
Executes the Degree Centrality algorithm and writes the results to the Neo4j database.
213+
Runs the Degree Centrality algorithm and stores the result in the Neo4j database as a new node property.
214+
215+
The Degree Centrality algorithm can be used to find popular nodes within a graph.
216+
The degree centrality measures the number of incoming or outgoing (or both) relationships from a node, which can be defined by the orientation of a relationship projection.
217+
It can be applied to either weighted or unweighted graphs.
218+
In the weighted case the algorithm computes the sum of all positive weights of adjacent relationships of a node, for each node in the graph.
209219
210220
Parameters
211221
----------

graphdatascience/procedure_surface/api/centrality/eigenvector_endpoints.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,12 @@ def stats(
104104
job_id: Optional[Any] = None,
105105
) -> EigenvectorStatsResult:
106106
"""
107-
Executes the Eigenvector Centrality algorithm and returns statistics without writing the result to Neo4j.
107+
Runs the Eigenvector Centrality algorithm and returns result statistics without storing the results.
108+
109+
Eigenvector Centrality is an algorithm that measures the transitive influence of nodes.
110+
Relationships originating from high-scoring nodes contribute more to the score of a node than connections from low-scoring nodes.
111+
A high eigenvector score means that a node is connected to many nodes who themselves have high scores.
112+
The algorithm computes the eigenvector associated with the largest absolute eigenvalue.
108113
109114
Parameters
110115
----------
@@ -220,7 +225,12 @@ def write(
220225
write_concurrency: Optional[Any] = None,
221226
) -> EigenvectorWriteResult:
222227
"""
223-
Executes the Eigenvector Centrality algorithm and writes the results to the Neo4j database.
228+
Runs the Eigenvector Centrality algorithm and stores the result in the Neo4j database as a new node property.
229+
230+
Eigenvector Centrality is an algorithm that measures the transitive influence of nodes.
231+
Relationships originating from high-scoring nodes contribute more to the score of a node than connections from low-scoring nodes.
232+
A high eigenvector score means that a node is connected to many nodes who themselves have high scores.
233+
The algorithm computes the eigenvector associated with the largest absolute eigenvalue.
224234
225235
Parameters
226236
----------

graphdatascience/procedure_surface/api/centrality/pagerank_endpoints.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ def stats(
100100
source_nodes: Optional[Any] = None,
101101
) -> PageRankStatsResult:
102102
"""
103-
Executes the PageRank algorithm and returns statistics.
103+
Runs the PageRank algorithm and returns result statistics without storing the results.
104+
105+
The PageRank algorithm measures the importance of each node within the graph, based on the number of incoming relationships and the importance of the corresponding source nodes.
106+
The underlying assumption roughly speaking is that a page is only as important as the pages that link to it.
104107
105108
Parameters
106109
----------
@@ -220,7 +223,10 @@ def write(
220223
write_concurrency: Optional[int] = None,
221224
) -> PageRankWriteResult:
222225
"""
223-
Executes the PageRank algorithm and writes the results back to the database.
226+
Runs the PageRank algorithm and stores the result in the Neo4j database as a new node property.
227+
228+
The PageRank algorithm measures the importance of each node within the graph, based on the number of incoming relationships and the importance of the corresponding source nodes.
229+
The underlying assumption roughly speaking is that a page is only as important as the pages that link to it.
224230
225231
Parameters
226232
----------

0 commit comments

Comments
 (0)