Skip to content

Commit af01a29

Browse files
jjaderbergIoannisPanagiotas
authored andcommitted
Fix up some docs formatting
1 parent a4651e2 commit af01a29

File tree

2 files changed

+55
-42
lines changed

2 files changed

+55
-42
lines changed

doc/modules/ROOT/pages/algorithms/directed-steiner-tree.adoc

Lines changed: 50 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,35 @@ include::partial$/operations-reference/beta-note.adoc[]
1414
:weighted:
1515
include::partial$/algorithms/shared/algorithm-traits.adoc[]
1616

17+
1718
== Introduction
1819

1920
Given a source node and a list of target nodes, a directed spanning tree in which there exists a path from the source node to each of the target nodes is called a Directed Steiner Tree.
2021

2122
The Minimum Directed Steiner Tree problem asks for the steiner tree that minimizes the sum of all relationship weights in tree.
2223

2324
The Minimum Directed Steiner Tree problem is known to be NP-Complete and no efficient exact algorithms have been proposed in the literature.
24-
The Neo4j GDS Library offers an efficient implementation of a well-known https://link.springer.com/chapter/10.1007/3-540-45643-0_1[heuristic] for Steiner Tree related problems.
25+
The Neo4j GDS Library offers an efficient implementation of a well-known https://link.springer.com/chapter/10.1007/3-540-45643-0_1[heuristic] for Steiner Tree related problems.
2526

26-
The implemented algorithm works on a number of steps. At each step, the shortest path from the source to one of the undiscovered targets is found and added to the result.
27+
The implemented algorithm works on a number of steps.
28+
At each step, the shortest path from the source to one of the undiscovered targets is found and added to the result.
2729
Following that, the weights in the relationships in this path are reduced to zero, and the algorithm continues similarly by finding the next closest unvisited target node.
2830

2931
With a careful implementation, the above heuristic can run efficiently even for graphs of large size.
30-
In addition, the parallel shortest path algorithm of xref:algorithms/delta-single-source.adoc[Delta-Stepping] is used to further speed-up computations.
32+
In addition, the parallel shortest path algorithm of xref:algorithms/delta-single-source.adoc[Delta-Stepping] is used to further speed-up computations.
33+
3134

3235
== Considerations
36+
3337
As the Minimum Directed Steiner Tree algorithm relies on shortest-paths, it will not work for graphs with negative relationship weights.
3438

3539
The Minimum Directed Steiner Tree problem is a variant of the more general Minimum Steiner Tree problem defined for undirected graphs.
36-
The Minimum Steiner Tree problem accepts as input only a set of target nodes.
40+
The Minimum Steiner Tree problem accepts as input only a set of target nodes.
3741
The aim is then to find a spanning tree of minimum weight connecting these target nodes.
3842

3943
It is possible to use the GDS implementation to find a solution for Minimum Steiner Tree problem by arbitrarily selecting one of the target nodes to fill the role of the source node.
44+
45+
4046
[[algorithms-directed-steiner-tree-syntax]]
4147
== Syntax
4248

@@ -63,18 +69,18 @@ include::partial$/algorithms/common-configuration/common-parameters.adoc[]
6369
.Configuration
6470
[opts="header",cols="3,2,3m,2,8"]
6571
|===
66-
| Name | Type | Default | Optional | Description
72+
| Name | Type | Default | Optional | Description
6773
include::partial$/algorithms/common-configuration/common-stream-stats-configuration-entries.adoc[]
6874
include::partial$/algorithms/steiner-tree/specific-configuration.adoc[]
6975
|===
7076

7177
.Results
7278
[opts="header",cols="1,1,6"]
7379
|===
74-
| Name | Type | Description
75-
| nodeId | Integer | a node in the discovered spanning tree
76-
| parentId | Integer | the parent of nodeId in the spanning tree or nodeId if it is equal to the source node.
77-
| weight | Float | The weight of the relationship from parentId to nodeId.
80+
| Name | Type | Description
81+
| nodeId | Integer | A node in the discovered spanning tree.
82+
| parentId | Integer | The parent of nodeId in the spanning tree or nodeId if it is equal to the source node.
83+
| weight | Float | The weight of the relationship from parentId to nodeId.
7884
|===
7985

8086
======
@@ -96,12 +102,13 @@ YIELD
96102
computeMillis: Integer,
97103
configuration: Map
98104
----
105+
99106
include::partial$/algorithms/common-configuration/common-parameters.adoc[]
100107

101108
.Configuration
102109
[opts="header",cols="3,2,3m,2,8"]
103-
|===
104-
| Name | Type | Default | Optional | Description
110+
| ===
111+
| Name | Type | Default | Optional | Description
105112
include::partial$/algorithms/common-configuration/common-stream-stats-configuration-entries.adoc[]
106113
include::partial$/algorithms/steiner-tree/specific-configuration.adoc[]
107114
|===
@@ -138,12 +145,13 @@ YIELD
138145
mutateMillis: Integer,
139146
configuration: Map
140147
----
148+
141149
include::partial$/algorithms/common-configuration/common-parameters.adoc[]
142150

143151
.Configuration
144152
[opts="header",cols="3,2,3m,2,8"]
145-
|===
146-
| Name | Type | Default | Optional | Description
153+
| ===
154+
| Name | Type | Default | Optional | Description
147155
include::partial$/algorithms/common-configuration/common-mutate-configuration-entries.adoc[]
148156
include::partial$/algorithms/steiner-tree/specific-configuration.adoc[]
149157
|===
@@ -182,12 +190,13 @@ YIELD
182190
writeMillis: Integer,
183191
configuration: Map
184192
----
193+
185194
include::partial$/algorithms/common-configuration/common-parameters.adoc[]
186195

187196
.Configuration
188197
[opts="header",cols="3,2,3m,2,8"]
189-
|===
190-
| Name | Type | Default | Optional | Description
198+
| ===
199+
| Name | Type | Default | Optional | Description
191200
include::partial$/algorithms/common-configuration/common-write-configuration-entries.adoc[]
192201
include::partial$/algorithms/steiner-tree/specific-configuration.adoc[]
193202
|===
@@ -250,9 +259,12 @@ CALL gds.graph.project(
250259
}
251260
)
252261
----
262+
263+
253264
[[algorithms-steiner-tree-examples-sream]]
254265
=== Stream
255266
:!stream-details:
267+
256268
include::partial$/algorithms/shared/examples-stream-intro.adoc[]
257269

258270
[role=query-example]
@@ -274,26 +286,25 @@ ORDER BY node
274286
.Results
275287
[opts="header"]
276288
|===
277-
| node |parent | weight
278-
| "A" | "A" | 0
279-
| "B" | "A" | 1
280-
| "C" | "B" | 1
281-
| "D" | "C" | 4
282-
| "E" | "C" | 6
283-
| "F" | "A" | 10
284-
289+
| node | parent | weight
290+
| "A" | "A" | 0
291+
| "B" | "A" | 1
292+
| "C" | "B" | 1
293+
| "D" | "C" | 4
294+
| "E" | "C" | 6
295+
| "F" | "A" | 10
285296
|===
286297
--
287298

288299
The algorithm first finds the shortest path from A to D.
289-
Then, even though the
290-
relationship weight from A to E is less than the sum of weighted path A,B,C,E,
291-
the algorithm realizes that the relationships between A and B as well as B and C are already included in the solution and therefore reaching E via C is a better alternative.
300+
Then, even though the relationship weight from A to E is less than the sum of weighted path A,B,C,E, the algorithm realizes that the relationships between A and B as well as B and C are already included in the solution and therefore reaching E via C is a better alternative.
292301
Finally, the algorithm adds the relationship between A and F in the solution and terminates.
293302

303+
294304
[[algorithms-steiner-tree-examples-stats]]
295305
=== Stats
296306
:stats-syntax: algorithms-directed-steiner-tree-syntax
307+
297308
include::partial$/algorithms/shared/examples-stats-intro.adoc[]
298309

299310
[role=query-example]
@@ -315,14 +326,14 @@ RETURN effectiveNodeCount, totalWeight
315326
[opts="header"]
316327
|===
317328
| effectiveNodeCount | totalWeight
318-
| 6 | 22
329+
| 6 | 22
319330
|===
320331
--
321332

333+
322334
[[algorithms-steiner-tree-examples-write]]
323335
=== Write
324336

325-
326337
include::partial$/algorithms/shared/examples-write-intro.adoc[]
327338

328339
[role=query-example, no-result=true,group=steiner-tree-write]
@@ -359,11 +370,11 @@ ORDER BY Source, Destination
359370
[opts="header",cols="1,1,1"]
360371
|===
361372
| Source | Destination | weight
362-
| "A" | "B" | 1
363-
| "A" | "F" | 10
364-
| "B" | "C" | 1
365-
| "C" | "D" | 4
366-
| "C" | "E" | 6
373+
| "A" | "B" | 1
374+
| "A" | "F" | 10
375+
| "B" | "C" | 1
376+
| "C" | "D" | 4
377+
| "C" | "E" | 6
367378
|===
368379
--
369380

@@ -372,6 +383,7 @@ ORDER BY Source, Destination
372383
The relationships written back to the graph are always directed, even if the input graph is undirected.
373384
====
374385

386+
375387
[[algorithms-steiner-tree-examples-mutate]]
376388
=== Mutate
377389

@@ -393,6 +405,7 @@ CALL gds.beta.steinerTree.mutate('graph', {
393405
YIELD relationshipsWritten
394406
RETURN relationshipsWritten
395407
----
408+
396409
.Results
397410
[opts="header"]
398411
|===
@@ -404,19 +417,20 @@ RETURN relationshipsWritten
404417
====
405418
The relationships added back to the graph are always directed, even if the input graph is undirected.
406419
====
420+
421+
407422
[[algorithms-steiner-tree-examples-rerouting]]
408423
=== Rerouting
409424

410-
It is also possible to try and augment the solution discovered by the heuristic via a post-processing rerouting phase.
411-
This option can be enabled by setting `applyRerouting:true` in the configuration.
425+
It is also possible to try and augment the solution discovered by the heuristic via a post-processing rerouting phase.
426+
This option can be enabled by setting `applyRerouting: true` in the configuration.
412427

413428
The rerouting phase re-examines the relationships in the discovered steiner tree and tries to reroute nodes (that is change their parent with another node in the tree) so as to decrease the cost.
414429
After the rerouting phase some nodes might end up being childless, that is not part of any path between the source and a target.
415430
Such nodes are then removed from the returned solution.
416431

417432
Note that there is no guarantee that enabling rerouting will always lead to an improvement in quality.
418433

419-
420434
[role=query-example]
421435
--
422436
.The following will run the Minimum Directed Steiner Tree algorithm with rerouting in stream mode and return results for each valid node.
@@ -444,7 +458,6 @@ ORDER BY node
444458
| "D" | "F" | 3
445459
| "E" | "C" | 6
446460
| "F" | "A" | 10
447-
448461
|===
449462
--
450463

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
| sourceNode | Integer | null | n/a | The starting source node ID.
2-
| targetNodes | List of Integer | null | n/a | The list of target nodes
3-
| xref:common-usage/running-algos.adoc#common-configuration-relationship-weight-property[relationshipWeightProperty] | String | null | yes | Name of the relationship property to use as weights. If unspecified, the algorithm runs unweighted.
4-
| delta | Float | 2.0 | yes | The bucket width for grouping nodes with the same tentative distance to the source node. Look into the xref:algorithms/delta-single-source.adoc[Delta-Stepping] documentation for more information.
5-
| applyRerouting | boolean | false | yes | If specified, the algorithm will try to improve the outcome via an additional post-processing heuristic.
1+
| sourceNode | Integer | null | n/a | The starting source node ID.
2+
| targetNodes | List of Integer | null | n/a | The list of target nodes
3+
| xref:common-usage/running-algos.adoc#common-configuration-relationship-weight-property[relationshipWeightProperty] | String | null | yes | Name of the relationship property to use as weights. If unspecified, the algorithm runs unweighted.
4+
| delta | Float | 2.0 | yes | The bucket width for grouping nodes with the same tentative distance to the source node. Look into the xref:algorithms/delta-single-source.adoc[Delta-Stepping] documentation for more information.
5+
| applyRerouting | boolean | false | yes | If specified, the algorithm will try to improve the outcome via an additional post-processing heuristic.

0 commit comments

Comments
 (0)