Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

FullComponentGeneratorCaller.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Graph.h>
35 #include <ogdf/basic/List.h>
38 
39 namespace ogdf {
40 template<typename T>
41 class EdgeWeightedGraph;
42 
43 namespace steiner_tree {
44 
45 template<typename T>
47 public:
49  static void computeDistanceMatrix(NodeArray<NodeArray<T>>& distance,
50  NodeArray<NodeArray<edge>>& pred, const EdgeWeightedGraph<T>& graph,
51  const List<node>& terminals, const NodeArray<bool>& isTerminal, int restricted);
52 };
53 
54 template<typename T>
56  NodeArray<NodeArray<edge>>& pred, const EdgeWeightedGraph<T>& graph,
57  const List<node>& terminals, const NodeArray<bool>& isTerminal, int restricted) {
58  if (steiner_tree::FullComponentDecisions::shouldUseDijkstra(restricted, graph.numberOfNodes(),
59  graph.numberOfEdges(), terminals.size())) {
60  if (restricted <= 3) {
61  // for 2- and 3-restricted computations, it is ok to use SSSP from all terminals
62  MinSteinerTreeModule<T>::allTerminalShortestPaths(graph, terminals, isTerminal,
63  distance, pred);
64  } else {
65  MinSteinerTreeModule<T>::allNodeShortestPaths(graph, terminals, isTerminal, distance,
66  pred);
67  }
68  } else {
69  MinSteinerTreeModule<T>::allPairShortestPaths(graph, isTerminal, distance, pred);
70  }
71 }
72 
73 }
74 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
Graph.h
Includes declaration of graph class.
ogdf::MinSteinerTreeModule::allTerminalShortestPaths
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.
Definition: MinSteinerTreeModule.h:188
ogdf::MinSteinerTreeModule::allNodeShortestPaths
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.
Definition: MinSteinerTreeModule.h:214
FullComponentDecisions.h
Definition of the FullComponentDecisions class.
MinSteinerTreeModule.h
Declaration of ogdf::MinSteinerTreeModule.
ogdf::EdgeWeightedGraph
Definition: GraphIO.h:56
ogdf::steiner_tree::FullComponentGeneratorCaller::computeDistanceMatrix
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.
Definition: FullComponentGeneratorCaller.h:55
ogdf::steiner_tree::FullComponentDecisions::shouldUseDijkstra
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...
Definition: FullComponentDecisions.h:94
ogdf::List
Doubly linked lists (maintaining the length of the list).
Definition: DfsMakeBiconnected.h:40
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
List.h
Declaration of doubly linked lists and iterators.
ogdf::MinSteinerTreeModule::allPairShortestPaths
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.
Definition: MinSteinerTreeModule.h:242
ogdf::steiner_tree::FullComponentGeneratorCaller
Definition: FullComponentGeneratorCaller.h:46
ogdf::List::size
int size() const
Returns the number of elements in the list.
Definition: List.h:1488