You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
20
21
21
22
The Minimum Directed Steiner Tree problem asks for the steiner tree that minimizes the sum of all relationship weights in tree.
22
23
23
24
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.
25
26
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.
27
29
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.
28
30
29
31
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
+
31
34
32
35
== Considerations
36
+
33
37
As the Minimum Directed Steiner Tree algorithm relies on shortest-paths, it will not work for graphs with negative relationship weights.
34
38
35
39
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.
37
41
The aim is then to find a spanning tree of minimum weight connecting these target nodes.
38
42
39
43
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.
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.
292
301
Finally, the algorithm adds the relationship between A and F in the solution and terminates.
The relationships added back to the graph are always directed, even if the input graph is undirected.
406
419
====
420
+
421
+
407
422
[[algorithms-steiner-tree-examples-rerouting]]
408
423
=== Rerouting
409
424
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.
412
427
413
428
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.
414
429
After the rerouting phase some nodes might end up being childless, that is not part of any path between the source and a target.
415
430
Such nodes are then removed from the returned solution.
416
431
417
432
Note that there is no guarantee that enabling rerouting will always lead to an improvement in quality.
418
433
419
-
420
434
[role=query-example]
421
435
--
422
436
.The following will run the Minimum Directed Steiner Tree algorithm with rerouting in stream mode and return results for each valid node.
| 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.
| 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