210 for(
node v : nodes) {
225 for(
edge e : edges) {
226 node v = e->source();
227 node w = e->target();
238 if(*nextEdge ==
nullptr || value < result) {
264 for(
node v : nodes) {
272 #ifdef OGDF_MINSTEINERTREE_PRIMAL_DUAL_LOGGING 273 cout <<
"Goemans primal-dual starting..." << std::endl;
274 cout <<
"terminals:";
280 cout <<
"loop starting... " << std::endl;
285 #ifdef OGDF_MINSTEINERTREE_PRIMAL_DUAL_LOGGING 286 cout <<
"active component exists" << std::endl;
289 edge minEdge =
nullptr;
293 #ifdef OGDF_MINSTEINERTREE_PRIMAL_DUAL_LOGGING 294 cout <<
"minEdge found: " << minEdge <<
", weight is " <<
m_pGraph->weight(minEdge) <<
", adjusted weight is " << minValue << std::endl;
300 if(finalSteinerTree->
copy(v) ==
nullptr) {
303 if(finalSteinerTree->
copy(w) ==
nullptr) {
308 T weight =
m_pGraph->weight(minEdge);
310 finalSteinerTree->
newEdge(minEdge, weight);
320 #ifdef OGDF_MINSTEINERTREE_PRIMAL_DUAL_LOGGING 321 cout <<
"calculation finished!" << std::endl;
bool isActive(int component) const
Returns whether the given component is active.
node target() const
Returns the target node of the edge.
void clear()
Removes all elements from the list.
node copy(node v) const
Returns the node in the graph copy corresponding to v.
node newNode(node vOrig)
Creates a new node in the graph copy with original node vOrig.
iterator pushBack(const E &x)
Adds element x at the end of the list.
void init()
Reinitializes the array. Associates the array with no graph.
virtual T call(const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal, EdgeWeightedGraphCopy< T > *&finalSteinerTree)
Builds a minimum Steiner tree given a weighted graph and a list of terminals.
This class serves as an interface for various methods to compute minimum or approximations of minimum...
Indexed arrays using hashing for element access.
edge newEdge(node u, node v, T weight)
Interface of Minimum Steiner Tree Algorithms.
Extends the GraphCopy concept to weighted graphs.
virtual T computeSteinerTree(const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal, EdgeWeightedGraphCopy< T > *&finalSteinerTree) override
Builds a minimum Steiner tree given a weighted graph and a list of terminals.
void del(iterator it)
Removes it from the list.
const EdgeWeightedGraph< T > * m_pGraph
void createEmpty(const Graph &wG)
virtual T call(const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal, EdgeWeightedGraphCopy< T > *&finalSteinerTree) override
Builds a minimum Steiner tree given a weighted graph and a list of terminals.
Doubly linked lists (maintaining the length of the list).
int find(disjoint_sets::CompressionOption< CompressionOptions::PathCompression >, int set)
DisjointSets * m_pComponents
A Union/Find data structure for maintaining disjoint sets.
int getComponent(const node v) const
Finds the biggest set including node v.
Class for the representation of edges.
Class for the representation of nodes.
void makeActive(int component)
Marks the specified component as active.
Primal-Dual approximation algorithm for Steiner tree problems.
static T pruneAllDanglingSteinerPaths(EdgeWeightedGraphCopy< T > &steinerTree, const NodeArray< bool > &isTerminal)
Prune Steiner nodes with degree 1 and their paths to terminal or branching nodes. ...
int makeSet()
Initializes a singleton set.
const List< node > * m_pTerminals
List< int > m_activeComponents
void init()
Initializes all required datastructes.
HashArray< int, ListIterator< int > > m_activeComponentIterators
int size() const
Returns the number of elements in the list.
Implementation of disjoint sets data structures (union-find functionality).
node source() const
Returns the source node of the edge.
int link(disjoint_sets::LinkOption< LinkOptions::Naive >, int set1, int set2)
The namespace for all OGDF objects.
double getNextEdge(edge *nextEdge)
Idendifies the next edge with a tight-to-be packing constraint.
NodeArray< double > m_priorities
void updatePriorities(double eps)
Must be called after merging any two components.
bool empty() const
Returns true iff the list is empty.
const NodeArray< bool > * m_pIsTerminal
NodeArray< int > m_componentMapping
double getLastLowerBound() const
Returns the lower bound calculated while solving the last problem.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
void mergeComponents(const node v, const node w)
Merges two disjoint components.