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
34#include <ogdf/basic/Graph.h>
35#include <ogdf/basic/List.h>
38
39namespace ogdf {
40template<typename T>
41class EdgeWeightedGraph;
42
43namespace steiner_tree {
44
45template<typename T>
47public:
49 static void computeDistanceMatrix(NodeArray<NodeArray<T>>& distance,
51 const List<node>& terminals, const NodeArray<bool>& isTerminal, int restricted);
52};
53
54template<typename T>
57 const List<node>& terminals, const NodeArray<bool>& isTerminal, int restricted) {
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}
Definition of the FullComponentDecisions class.
Includes declaration of graph class.
Declaration of doubly linked lists and iterators.
Declaration of ogdf::MinSteinerTreeModule.
int numberOfNodes() const
Returns the number of nodes in the graph.
Definition Graph_d.h:979
int numberOfEdges() const
Returns the number of edges in the graph.
Definition Graph_d.h:982
Doubly linked lists (maintaining the length of the list).
Definition List.h:1451
int size() const
Returns the number of elements in the list.
Definition List.h:1488
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.
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
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.
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...