@@ -13,8 +13,6 @@ include::partial$/algorithms/shared/algorithm-traits.adoc[]
13
13
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.
14
14
As with many of the centrality algorithms, it originates from the field of social network analysis.
15
15
16
- include::partial$/operations-reference/alpha-note.adoc[]
17
-
18
16
19
17
[[algorithms-harmonic-centrality-context]]
20
18
== History and explanation
@@ -55,12 +53,45 @@ include::partial$/algorithms/shared/syntax-intro-named-graph.adoc[]
55
53
[.tabbed-example, caption = ]
56
54
====
57
55
58
- [.include-with-write ]
56
+ [.include-with-stream ]
59
57
======
60
- .The following will run the algorithm and write back results:
58
+ .The following will run the algorithm and stream results:
61
59
[source, cypher, role=noplay]
62
60
----
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(
64
95
graphName: String,
65
96
configuration: Map
66
97
)
69
100
preProcessingMillis: Integer,
70
101
computeMillis: Integer,
71
102
postProcessingMillis: Integer,
72
- writeMillis: Integer,
73
- nodePropertiesWritten: Integer,
74
103
configuration: Map
75
104
----
76
105
@@ -81,7 +110,6 @@ include::partial$/algorithms/common-configuration/common-parameters.adoc[]
81
110
|===
82
111
| Name | Type | Default | Optional | Description
83
112
include::partial$/algorithms/common-configuration/common-configuration-jobid-concurrency-entries.adoc[]
84
- include::partial$/algorithms/common-configuration/common-write-configuration-entries.adoc[]
85
113
|===
86
114
87
115
.Results
@@ -92,43 +120,93 @@ include::partial$/algorithms/common-configuration/common-write-configuration-ent
92
120
| preProcessingMillis | Integer | Milliseconds for preprocessing the graph.
93
121
| computeMillis | Integer | Milliseconds for running the algorithm.
94
122
| 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.
97
123
| configuration | Map | The configuration used for running the algorithm.
98
124
|===
99
125
100
126
======
101
127
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
+ |===
102
167
103
- [.include-with-stream]
104
168
======
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:
106
173
[source, cypher, role=noplay]
107
174
----
108
- CALL gds.closeness.harmonic.stream (
175
+ CALL gds.closeness.harmonic.write (
109
176
graphName: String,
110
177
configuration: Map
111
178
)
112
179
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
115
187
----
116
188
117
189
include::partial$/algorithms/common-configuration/common-parameters.adoc[]
118
190
119
191
.Configuration
120
192
[opts="header",cols="1,1,1,1,4"]
121
193
|===
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[]
124
197
|===
125
198
126
199
.Results
127
- [opts="header"]
200
+ [opts="header",cols="1,1,6" ]
128
201
|===
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.
132
210
|===
133
211
134
212
======
@@ -187,6 +265,40 @@ ORDER BY score DESC
187
265
|===
188
266
--
189
267
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
+
190
302
[role=query-example]
191
303
--
192
304
.The following will run the algorithm and write back results:
0 commit comments