Skip to content

Commit 3b278da

Browse files
authored
Merge pull request #10731 from brs96/promote-harmonic-centrality
Promote harmonic centrality
2 parents 2fe477f + d009499 commit 3b278da

File tree

1 file changed

+133
-21
lines changed

1 file changed

+133
-21
lines changed

doc/modules/ROOT/pages/algorithms/harmonic-centrality.adoc

Lines changed: 133 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ include::partial$/algorithms/shared/algorithm-traits.adoc[]
1313
Harmonic centrality (also known as valued centrality) is a variant of closeness centrality, that was invented to solve the problem the original formula had when dealing with unconnected graphs.
1414
As with many of the centrality algorithms, it originates from the field of social network analysis.
1515

16-
include::partial$/operations-reference/alpha-note.adoc[]
17-
1816

1917
[[algorithms-harmonic-centrality-context]]
2018
== History and explanation
@@ -55,12 +53,45 @@ include::partial$/algorithms/shared/syntax-intro-named-graph.adoc[]
5553
[.tabbed-example, caption = ]
5654
====
5755
58-
[.include-with-write]
56+
[.include-with-stream]
5957
======
60-
.The following will run the algorithm and write back results:
58+
.The following will run the algorithm and stream results:
6159
[source, cypher, role=noplay]
6260
----
63-
CALL gds.closeness.harmonic.write(
61+
CALL gds.closeness.harmonic.stream(
62+
graphName: String,
63+
configuration: Map
64+
)
65+
YIELD
66+
nodeId: Integer,
67+
score: Float
68+
----
69+
70+
include::partial$/algorithms/common-configuration/common-parameters.adoc[]
71+
72+
.Configuration
73+
[opts="header",cols="1,1,1,1,4"]
74+
|===
75+
| Name | Type | Default | Optional | Description
76+
include::partial$/algorithms/common-configuration/common-stream-stats-configuration-entries.adoc[]
77+
|===
78+
79+
.Results
80+
[opts="header"]
81+
|===
82+
| Name | Type | Description
83+
| nodeId | Integer | Node ID.
84+
| score | Float | Harmonic centrality score.
85+
|===
86+
87+
======
88+
89+
[.include-with-stats]
90+
======
91+
.The following will run the algorithm and return statistics:
92+
[source, cypher, role=noplay]
93+
----
94+
CALL gds.closeness.harmonic.stats(
6495
graphName: String,
6596
configuration: Map
6697
)
@@ -69,8 +100,6 @@ YIELD
69100
preProcessingMillis: Integer,
70101
computeMillis: Integer,
71102
postProcessingMillis: Integer,
72-
writeMillis: Integer,
73-
nodePropertiesWritten: Integer,
74103
configuration: Map
75104
----
76105

@@ -81,7 +110,6 @@ include::partial$/algorithms/common-configuration/common-parameters.adoc[]
81110
|===
82111
| Name | Type | Default | Optional | Description
83112
include::partial$/algorithms/common-configuration/common-configuration-jobid-concurrency-entries.adoc[]
84-
include::partial$/algorithms/common-configuration/common-write-configuration-entries.adoc[]
85113
|===
86114

87115
.Results
@@ -92,43 +120,93 @@ include::partial$/algorithms/common-configuration/common-write-configuration-ent
92120
| preProcessingMillis | Integer | Milliseconds for preprocessing the graph.
93121
| computeMillis | Integer | Milliseconds for running the algorithm.
94122
| postProcessingMillis | Integer | Milliseconds for computing the statistics.
95-
| writeMillis | Integer | Milliseconds for writing result data back.
96-
| nodePropertiesWritten | Integer | Number of properties written to Neo4j.
97123
| configuration | Map | The configuration used for running the algorithm.
98124
|===
99125

100126
======
101127
128+
[.include-with-mutate]
129+
======
130+
.The following will run the algorithm and update the graph:
131+
[source, cypher, role=noplay]
132+
----
133+
CALL gds.closeness.harmonic.mutate(
134+
graphName: String,
135+
configuration: Map
136+
)
137+
YIELD
138+
centralityDistribution: Map,
139+
preProcessingMillis: Integer,
140+
computeMillis: Integer,
141+
mutateMillis: Integer,
142+
nodePropertiesWritten: Integer,
143+
configuration: Map
144+
----
145+
146+
include::partial$/algorithms/common-configuration/common-parameters.adoc[]
147+
148+
.Configuration
149+
[opts="header",cols="1,1,1,1,4"]
150+
|===
151+
| Name | Type | Default | Optional | Description
152+
include::partial$/algorithms/common-configuration/common-configuration-jobid-concurrency-entries.adoc[]
153+
include::partial$/algorithms/common-configuration/common-mutate-configuration-entries.adoc[]
154+
|===
155+
156+
.Results
157+
[opts="header",cols="1,1,6"]
158+
|===
159+
| Name | Type | Description
160+
| centralityDistribution | Map | Map containing min, max, mean as well as p50, p75, p90, p95, p99 and p999 percentile values of centrality values.
161+
| preProcessingMillis | Integer | Milliseconds for preprocessing the graph.
162+
| computeMillis | Integer | Milliseconds for running the algorithm.
163+
| mutateMillis | Integer | Milliseconds for adding properties to the projected graph.
164+
| nodePropertiesWritten | Integer | Number of properties written to the projected graph.
165+
| configuration | Map | The configuration used for running the algorithm.
166+
|===
102167

103-
[.include-with-stream]
104168
======
105-
.The following will run the algorithm and stream results:
169+
170+
[.include-with-write]
171+
======
172+
.The following will run the algorithm and write back results:
106173
[source, cypher, role=noplay]
107174
----
108-
CALL gds.closeness.harmonic.stream(
175+
CALL gds.closeness.harmonic.write(
109176
graphName: String,
110177
configuration: Map
111178
)
112179
YIELD
113-
nodeId: Integer,
114-
score: Float
180+
centralityDistribution: Map,
181+
preProcessingMillis: Integer,
182+
computeMillis: Integer,
183+
postProcessingMillis: Integer,
184+
writeMillis: Integer,
185+
nodePropertiesWritten: Integer,
186+
configuration: Map
115187
----
116188

117189
include::partial$/algorithms/common-configuration/common-parameters.adoc[]
118190

119191
.Configuration
120192
[opts="header",cols="1,1,1,1,4"]
121193
|===
122-
| Name | Type | Default | Optional | Description
123-
include::partial$/algorithms/common-configuration/common-stream-stats-configuration-entries.adoc[]
194+
| Name | Type | Default | Optional | Description
195+
include::partial$/algorithms/common-configuration/common-configuration-jobid-concurrency-entries.adoc[]
196+
include::partial$/algorithms/common-configuration/common-write-configuration-entries.adoc[]
124197
|===
125198

126199
.Results
127-
[opts="header"]
200+
[opts="header",cols="1,1,6"]
128201
|===
129-
| Name | Type | Description
130-
| nodeId | Integer | Node ID.
131-
| score | Float | Harmonic centrality score.
202+
| Name | Type | Description
203+
| centralityDistribution | Map | Map containing min, max, mean as well as p50, p75, p90, p95, p99 and p999 percentile values of centrality values.
204+
| preProcessingMillis | Integer | Milliseconds for preprocessing the graph.
205+
| computeMillis | Integer | Milliseconds for running the algorithm.
206+
| postProcessingMillis | Integer | Milliseconds for computing the statistics.
207+
| writeMillis | Integer | Milliseconds for writing result data back.
208+
| nodePropertiesWritten | Integer | Number of properties written to Neo4j.
209+
| configuration | Map | The configuration used for running the algorithm.
132210
|===
133211

134212
======
@@ -187,6 +265,40 @@ ORDER BY score DESC
187265
|===
188266
--
189267

268+
[role=query-example]
269+
--
270+
.The following will run the algorithm and return statistics:
271+
[source, cypher, role=noplay]
272+
----
273+
CALL gds.closeness.harmonic.stats('graph', {})
274+
YIELD centralityDistribution
275+
----
276+
277+
.Results
278+
[opts="header"]
279+
|===
280+
| centralityDistribution
281+
| {max=0.5000038147, mean=0.3500003815, min=0.25, p50=0.375, p75=0.375, p90=0.5000019073, p95=0.5000019073, p99=0.5000019073, p999=0.5000019073}
282+
|===
283+
--
284+
285+
[role=query-example]
286+
--
287+
.The following will run the algorithm and update the graph:
288+
[source, cypher, role=noplay]
289+
----
290+
CALL gds.closeness.harmonic.mutate('graph', {mutateProperty: 'harmonicScore'})
291+
YIELD nodePropertiesWritten, centralityDistribution
292+
----
293+
294+
.Results
295+
[opts="header"]
296+
|===
297+
| nodePropertiesWritten | centralityDistribution
298+
| 5 | {max=0.5000038147, mean=0.3500003815, min=0.25, p50=0.375, p75=0.375, p90=0.5000019073, p95=0.5000019073, p99=0.5000019073, p999=0.5000019073}
299+
|===
300+
--
301+
190302
[role=query-example]
191303
--
192304
.The following will run the algorithm and write back results:

0 commit comments

Comments
 (0)