47class EdgeWeightedGraph;
49namespace steiner_tree {
85 if ((*it).cut.size() < (*bestIt).cut.size()) {
103 node w = adj->twinNode();
118 node w = adj->twinNode();
121 if (cutAdjIt != td.
cut.end()) {
122 td.
cut.del(cutAdjIt);
132 if (!(*it).inCut[w]) {
141 for (
auto ref : (*it).references) {
173 T cost = std::numeric_limits<T>::max();
214 for (
node t : terminals) {
288 edge uv = network.
newEdge(copy[e->source()], copy[e->target()]);
289 edge vu = network.
newEdge(copy[e->target()], copy[e->source()]);
292 orig[uv] = orig[vu] = e;
299 sssp.
call(network, weights, copy[root], pred, distance,
true);
302 lbNodes.
init(graph, alg.
get());
303 lbEdges.
init(graph, alg.
get());
308 lbNodes[v] += distance[copy[v]];
312 lbArcs[a] += distance[a->source()] + weights[a];
320 for (
node t : terminals) {
325 sssp.
call(network, weights, nonRootTerminals, pred, distance,
true);
329 lbNodes[v] += distance[copy[v]];
333 lbArcs[a] += distance[a->source()];
348 for (
node root : terminals) {
365 compute(graph, terminals, terminals.
front(), lbNodes, lbEdges);
367 lbNodes.
init(graph, 0);
368 lbEdges.
init(graph, 0);
370 for (
node root : terminals) {
373 compute(graph, terminals, root, nodes, edges);
Declaration and implementation of ArrayBuffer class.
Compare floating point numbers with epsilons and integral numbers with normal compare operators.
Includes declaration of graph class.
Decralation of GraphElement and GraphList classes.
Declaration of doubly linked lists and iterators.
Basic declarations, included by all source files.
Class for adjacency list elements.
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
node theNode() const
Returns the node whose adjacency list contains this element.
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
void push(E e)
Puts a new element in the buffer.
Dijkstra's single source shortest path algorithm.
void call(const Graph &G, const EdgeArray< T > &weight, const List< node > &sources, NodeArray< edge > &predecessor, NodeArray< T > &distance, bool directed=false, bool arcsReversed=false, node target=nullptr, T maxLength=std::numeric_limits< T >::max())
Calculates, based on the graph G with corresponding edge costs and source nodes, the shortest paths a...
Class for the representation of edges.
T weight(const edge e) const
std::enable_if< std::is_integral< T >::value, bool >::type leq(const T &x, const T &y) const
Compare if x is LEQ than y for integral types.
std::enable_if< std::is_integral< T >::value, bool >::type geq(const T &x, const T &y) const
Compare if x is GEQ to y for integral types.
std::enable_if< std::is_integral< T >::value, bool >::type equal(const T &x, const T &y) const
Compare if x is EQUAL to y for integral types.
Data type for general directed graphs (adjacency list representation).
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
node newNode(int index=-1)
Creates a new node and returns it.
edge newEdge(node v, node w, int index=-1)
Creates a new edge (v,w) and returns it.
void reverseAllEdges()
Reverses all edges in the graph.
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
Doubly linked lists (maintaining the length of the list).
iterator pushBack(const E &x)
Adds element x at the end of the list.
Encapsulates a pointer to a list element.
const_reference front() const
Returns a const reference to the first element.
Class for the representation of nodes.
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.
void init(const Base *base=nullptr)
Reinitializes the array. Associates the array with the matching registry of base.
Implementation of a dual-ascent-based lower bound heuristic for Steiner tree problems.
T call(const EdgeWeightedGraph< T > &graph, const List< node > &terminals)
Calls the algorithm and returns the lower bound.
void setRepetitions(int num)
Sets the number of repeated calls to the lower bound algorithm (runs with different roots)
void compute(const EdgeWeightedGraph< T > &graph, const List< node > &terminals, node root, NodeArray< T > &lbNodes, EdgeArray< T > &lbEdges)
void call(const EdgeWeightedGraph< T > &graph, const List< node > &terminals, NodeArray< T > &lbNodes, EdgeArray< T > &lbEdges)
Compute the lower bounds under the assumption nodes or edges are included in the solution.
T compute(const EdgeWeightedGraph< T > &graph, const List< node > &terminals, node root)
RegisteredArray for edges of a graph, specialized for EdgeArray<edge>.
RegisteredArray for nodes, edges and adjEntries of a graph.
Computes lower bounds for minimum Steiner tree instances.
AdjEntryArray< T > m_reducedCost
void compute()
Computes the lower bound.
bool addNode(ListIterator< TerminalData > &it, node t)
Adds a node to the cut and add neighbors recursively.
T findCheapestCutArcCost(const TerminalData &td) const
Finds the cheapest arc in cut and returns its cost.
const EdgeWeightedGraph< T > & m_graph
T reducedCost(adjEntry adj) const
Returns the reduced cost of the arc given by adj.
void removeTerminalData(ListIterator< TerminalData > it)
bool addNodeChecked(ListIterator< TerminalData > &it, node w)
ListIterator< TerminalData > chooseTerminal()
Finds the terminal with the smallest cut arc set (of the last iteration)
LowerBoundDualAscent(const EdgeWeightedGraph< T > &graph, const List< node > &terminals, double eps=1e-6)
Initializes the algorithm (and takes the first terminal as root)
LowerBoundDualAscent(const EdgeWeightedGraph< T > &graph, const List< node > &terminals, node root, double eps=1e-6)
Initializes the algorithm.
NodeArray< List< ListIterator< TerminalData > > > m_inTerminalCut
Mapping of nodes to the cuts they are in.
void extendCut(adjEntry adj)
Assumes that the reduced cost of arc adj is zeroed and hence updates (in relevant cuts) the set of ar...
void update(TerminalData &td, T delta)
Updates reduced costs and cut data.
List< TerminalData > m_terminals
T get() const
Returns the lower bound.
Implementation of Dijkstra's single source shortest path algorithm.
bool isConnected(const Graph &G)
Returns true iff G is connected.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
void updateMin(T &min, const T &newValue)
Stores the minimum of min and newValue in min.
void updateMax(T &max, const T &newValue)
Stores the maximum of max and newValue in max.
The namespace for all OGDF objects.
HypergraphRegistry< HypernodeElement >::iterator begin(const HypergraphRegistry< HypernodeElement > &self)
ArrayBuffer< TerminalDataReference > references
TerminalData(const EdgeWeightedGraph< T > &graph, node t)
AdjEntryArray< ListIterator< adjEntry > > cutIterators
ListIterator< ListIterator< TerminalData > > it