Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
FullComponentGeneratorCaller.h
Go to the documentation of this file.
1
32#pragma once
33
36
37namespace ogdf {
38namespace steiner_tree {
39
40template<typename T>
42public:
44 static void computeDistanceMatrix(NodeArray<NodeArray<T>>& distance,
46 const List<node>& terminals, const NodeArray<bool>& isTerminal, int restricted);
47};
48
49template<typename T>
52 const List<node>& terminals, const NodeArray<bool>& isTerminal, int restricted) {
54 graph.numberOfEdges(), terminals.size())) {
55 if (restricted <= 3) {
56 // for 2- and 3-restricted computations, it is ok to use SSSP from all terminals
57 MinSteinerTreeModule<T>::allTerminalShortestPaths(graph, terminals, isTerminal,
58 distance, pred);
59 } else {
60 MinSteinerTreeModule<T>::allNodeShortestPaths(graph, terminals, isTerminal, distance,
61 pred);
62 }
63 } else {
64 MinSteinerTreeModule<T>::allPairShortestPaths(graph, isTerminal, distance, pred);
65 }
66}
67
68}
69}
Definition of the FullComponentDecisions class.
Declaration of ogdf::MinSteinerTreeModule.
int numberOfNodes() const
Returns the number of nodes in the graph.
Definition Graph_d.h:622
int numberOfEdges() const
Returns the number of edges in the graph.
Definition Graph_d.h:625
Doubly linked lists (maintaining the length of the list).
Definition List.h:1435
int size() const
Returns the number of elements in the list.
Definition List.h:1472
static void allTerminalShortestPaths(const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal, NodeArray< NodeArray< T > > &distance, NodeArray< NodeArray< edge > > &pred, std::function< void(const EdgeWeightedGraph< T > &, node, const NodeArray< bool > &, NodeArray< T > &, NodeArray< edge > &)> ssspFunc=singleSourceShortestPaths)
Runs a given (or the default) single-source-shortest-paths function from all terminals.
static void allPairShortestPaths(const EdgeWeightedGraph< T > &G, const NodeArray< bool > &isTerminal, NodeArray< NodeArray< T > > &distance, NodeArray< NodeArray< edge > > &pred)
The default all-pair-shortest-paths algorithm.
static void allNodeShortestPaths(const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal, NodeArray< NodeArray< T > > &distance, NodeArray< NodeArray< edge > > &pred, std::function< void(const EdgeWeightedGraph< T > &, node, const NodeArray< bool > &, NodeArray< T > &, NodeArray< edge > &)> ssspFunc=singleSourceShortestPaths)
Runs a given (or the default) single-source-shortest-paths function from all nodes.
Dynamic arrays indexed with nodes.
Definition NodeArray.h:125
static void computeDistanceMatrix(NodeArray< NodeArray< T > > &distance, NodeArray< NodeArray< edge > > &pred, const EdgeWeightedGraph< T > &graph, const List< node > &terminals, const NodeArray< bool > &isTerminal, int restricted)
Computes distance and predecessor matrix.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
static bool shouldUseDijkstra(int k, int n, int m, int t)
Returns true iff the rule of thumb predicts to use multiple Dijkstra calls instead of the algorithm b...