34 #include <forward_list> 37 #include <unordered_map> 49 namespace steiner_tree {
58 return static_cast<int>((
static_cast<long long>(
137 T cost = mst.
call(m_copyGraph, m_copyTerminals, m_copyIsTerminal, reducedSolution);
138 cost += costEdgesAlreadyInserted();
139 computeOriginalSolution(*reducedSolution, *finalSteinerTree);
140 delete reducedSolution;
156 for (
node t : m_copyTerminals) {
157 const node tC = nCopy[t];
159 ccIsTerminal[tC] =
true;
164 T cost = mst.
call(ccGraph, ccTerminals, ccIsTerminal, ccSolution);
165 cost += costEdgesAlreadyInserted();
171 if (ccSolution->
copy(nCopy[v]) !=
nullptr) {
176 if (ccSolution->
copy(eCopy[e]) !=
nullptr) {
182 computeOriginalSolution(reducedSolution, *finalSteinerTree);
209 inline T costEdgesAlreadyInserted()
const {
return m_costAlreadyInserted; }
229 return repeat([
this]() {
230 bool changed =
false;
231 changed |= degree2Test();
233 changed |= deleteLeaves();
244 bool changed = deleteComponentsWithoutTerminals();
245 bool triviallyChanged =
false;
246 changed |= repeat([
this, &triviallyChanged, k]() {
247 bool innerChanged =
false;
248 triviallyChanged = reduceTrivial();
251 if (nearestVertexTest()) {
257 if (terminalDistanceTest()) {
259 deleteComponentsWithoutTerminals();
264 innerChanged |= NTDkTest(10, k);
268 innerChanged |= shortLinksTest();
272 innerChanged |= lowerBoundBasedTest();
275 innerChanged |= PTmTest(k);
280 return changed | triviallyChanged;
285 return repeat([
this] {
286 bool changed = reduceFast();
287 changed |= dualAscentBasedTest();
323 bool deleteComponentsWithoutTerminals();
331 bool leastCostTest();
348 bool PTmTest(
const int k = 3);
358 bool terminalDistanceTest();
366 bool longEdgesTest();
378 bool NTDkTest(
const int maxTestedDegree = 5,
const int k = 3);
388 bool nearestVertexTest();
398 bool shortLinksTest();
410 bool lowerBoundBasedTest(T upperBound);
417 return lowerBoundBasedTest(computeMinSteinerTreeUpperBound());
429 bool dualAscentBasedTest(
int repetitions, T upperBound);
436 return dualAscentBasedTest(repetitions, computeMinSteinerTreeUpperBound());
449 bool reachabilityTest(
int maxDegreeTest = 0,
const int k = 3);
459 bool cutReachabilityTest();
470 m_costUpperBoundAlgorithm.reset(pMinSteinerTreeModule);
476 static bool repeat(std::function<
bool()> f) {
477 bool changed =
false;
493 template<
typename TWhat,
typename TWhatArray>
494 void addNew(TWhat x,
const std::vector<node> &replacedNodes,
const std::vector<edge> &replacedEdges,
bool deleteReplacedElements,
495 TWhatArray &whatSonsListIndex);
498 inline void addNewNode(
node v,
const std::vector<node> &replacedNodes,
const std::vector<edge> &replacedEdges,
bool deleteReplacedElements)
500 addNew(v, replacedNodes, replacedEdges, deleteReplacedElements, m_nodeSonsListIndex);
504 inline void addNewEdge(
edge e,
const std::vector<node> &replacedNodes,
const std::vector<edge> &replacedEdges,
bool deleteReplacedElements)
506 addNew(e, replacedNodes, replacedEdges, deleteReplacedElements, m_edgeSonsListIndex);
515 bool addEdgesToSolution(
const List<edge> &edgesToBeAddedInSolution);
518 void recomputeTerminalsList();
528 finalSteinerTree =
nullptr;
529 return m_costUpperBoundAlgorithm->call(m_copyGraph, m_copyTerminals, m_copyIsTerminal, finalSteinerTree);
536 T treeCostUpperBound = computeMinSteinerTreeUpperBound(finalSteinerTree);
537 delete finalSteinerTree;
538 return treeCostUpperBound;
542 void addToSolution(
const int listIndex,
Array<bool, int> &isInSolution)
const;
545 bool deleteNodesAboveUpperBound(
const NodeArray<T> &lowerBoundWithNode,
const T upperBound);
547 bool deleteEdgesAboveUpperBound(
const EdgeArray<T> &lowerBoundWithEdge,
const T upperBound);
550 void deleteSteinerDegreeTwoNode(
node v,
564 void findClosestNonTerminals(
node source,
List<node> &reachedNodes,
NodeArray<T> &distance, T maxDistance,
int expandedEdges)
const;
570 T computeBottleneckDistance(
node x,
node y,
573 const NodeArray<
List<std::pair<node,T>>>& closestTerminals)
const;
580 void computeClosestKTerminals(
const int k,
NodeArray<
List<std::pair<node,T>>> &closestTerminals)
const;
583 void computeRadiusOfTerminals(
NodeArray<T> &terminalRadius)
const;
586 T computeRadiusSum()
const;
589 template<
typename LAMBDA>
590 void computeOptimalTerminals(
node v, LAMBDA dist,
node &optimalTerminal1,
node &optimalTerminal2,
NodeArray<T> &distance)
const;
596 void findTwoMinimumCostEdges(
node v,
edge& first,
edge& second)
const;
602 , m_origTerminals(terminals)
603 , m_origIsTerminal(isTerminal)
614 nCopy[v] = m_copyGraph.
newNode();
621 m_copyTerminals.
clear();
622 m_copyIsTerminal.
init(m_copyGraph,
false);
625 const node vC = nCopy[v];
627 m_copyIsTerminal[vC] =
true;
630 m_costAlreadyInserted = 0;
633 m_nodeSonsListIndex.
init(m_copyGraph);
634 m_edgeSonsListIndex.
init(m_copyGraph);
637 m_nodeSonsListIndex[nCopy[v]] = -(nextIndex++);
640 m_edgeSonsListIndex[eCopy[e]] = -(nextIndex++);
648 template<
typename TWhat,
typename TWhatArray>
650 const std::vector<node> &replacedNodes,
651 const std::vector<edge> &replacedEdges,
652 bool deleteReplacedElements,
653 TWhatArray &whatSonsListIndex)
655 std::vector<int> sonsIndexList;
656 for (
node replacedNode : replacedNodes) {
657 sonsIndexList.push_back(m_nodeSonsListIndex[replacedNode]);
659 for (
edge replacedEdge : replacedEdges) {
660 sonsIndexList.push_back(m_edgeSonsListIndex[replacedEdge]);
663 m_sonsList.emplace_back(sonsIndexList);
664 whatSonsListIndex[x] = (int)m_sonsList.size() - 1;
666 if (deleteReplacedElements) {
667 for (
edge e : replacedEdges) {
670 for (
node v :replacedNodes) {
680 isInSolution[listIndex] =
true;
684 for (
int son : m_sonsList[listIndex]) {
692 correspondingOriginalSolution.
createEmpty(m_origGraph);
697 for (
node v : reducedGraphSolution.
nodes) {
700 for (
edge e : reducedGraphSolution.
edges) {
707 if (isInSolution[-(nextIndex++)]) {
708 correspondingOriginalSolution.
newNode(v);
712 if (isInSolution[-(nextIndex++)]) {
713 correspondingOriginalSolution.
newEdge(e, m_origGraph.
weight(e));
730 std::forward_list<NewEdgeData> newEdges;
736 const edge e2 = adj2->theEdge();
737 const node adjacentNode2 = adj2->twinNode();
739 T edgeWeight = m_copyGraph.
weight(e1) + m_copyGraph.
weight(e2);
741 const edge f = m_copyGraph.
searchEdge(adjacentNode1, adjacentNode2);
742 if (f && m_copyGraph.
weight(f) <= edgeWeight) {
747 if (m_eps.
greater(edgeWeight, bottleneckDistance)) {
751 newEdges.emplace_front(NewEdgeData{e1, e2, f, edgeWeight});
755 for (
const auto &newEdge : newEdges) {
758 if (newEdge.already) {
760 m_copyGraph.
setWeight(newEdge.already, newEdge.weight);
761 newEdgeInGraph = newEdge.already;
763 newEdgeInGraph = m_copyGraph.
newEdge(newEdge.e1->opposite(v), newEdge.e2->opposite(v), newEdge.weight);
765 addNewEdge(newEdgeInGraph, {v}, {newEdge.e1, newEdge.e2},
false);
774 m_copyTerminals.
clear();
776 if (m_copyIsTerminal[v]) {
786 const NodeArray<
List<std::pair<node, T>>> &closestTerminals)
const 788 T bottleneckDistance = std::numeric_limits<T>::max();
790 for (
auto &xCloseTerminalDistancePair : closestTerminals[x]) {
791 for (
auto &yCloseTerminalDistancePair : closestTerminals[y]) {
792 T possibleBottleneckDistance = xCloseTerminalDistancePair.second + yCloseTerminalDistancePair.second;
794 node xTprimeCopy = tprime.
copy(xCloseTerminalDistancePair.first);
795 node yTprimeCopy = tprime.
copy(yCloseTerminalDistancePair.first);
802 return bottleneckDistance;
809 auto deleteAll = [
this]() {
813 for (
node v = m_copyGraph.
firstNode(), nextV; v; v = nextV) {
823 if (m_copyTerminals.
size() == 1) {
835 if (eraseQueue.empty()) {
839 for (; !eraseQueue.empty(); eraseQueue.pop()) {
840 node v = eraseQueue.top();
846 if (m_copyIsTerminal[v]) {
848 edge e = v->firstAdj()->theEdge();
849 if (!m_copyIsTerminal[w]) {
850 m_copyIsTerminal[w] =
true;
853 m_copyTerminals.
del(m_copyTerminals.
search(v));
854 m_costAlreadyInserted += m_copyGraph.
weight(e);
855 int cur = m_nodeSonsListIndex[w];
857 m_sonsList.emplace_back(std::vector<int>{cur, m_nodeSonsListIndex[v], m_edgeSonsListIndex[e]});
858 m_nodeSonsListIndex[w] = (int)m_sonsList.
size() - 1;
860 m_sonsList[cur].push_back(m_nodeSonsListIndex[v]);
861 m_sonsList[cur].push_back(m_edgeSonsListIndex[e]);
864 if (w->degree() == 2) {
865 eraseQueue.append(w);
869 if (m_copyTerminals.
size() == 1) {
880 bool changed =
false;
884 nextAdj = adj->succ();
886 edge e = adj->theEdge();
887 node adjNode = adj->twinNode();
889 if (nextAdj == adj->twin()) {
890 nextAdj = nextAdj->
succ();
895 if (minCostEdge[adjNode] ==
nullptr 896 || m_copyGraph.
weight(minCostEdge[adjNode]) > m_copyGraph.
weight(e)) {
897 if (minCostEdge[adjNode] !=
nullptr) {
898 m_copyGraph.
delEdge(minCostEdge[adjNode]);
901 minCostEdge[adjNode] = e;
910 minCostEdge[adj->
twinNode()] =
nullptr;
922 shortestPath[v1][v2] = shortestPath[v2][v1] = min(shortestPath[v1][v2], m_copyGraph.
weight(adj->
theEdge()));
929 if (shortestPath[v1][pivot] == std::numeric_limits<T>::max()
930 || shortestPath[pivot][v2] == std::numeric_limits<T>::max()) {
934 Math::updateMin(shortestPath[v1][v2], shortestPath[v1][pivot] + shortestPath[pivot][v2]);
943 shortestPath.init(m_copyGraph);
945 shortestPath[v].init(m_copyGraph, std::numeric_limits<T>::max());
954 bool changed =
false;
960 nextAdj = adj->succ();
962 edge e = adj->theEdge();
963 node adjNode = adj->twinNode();
965 && shortestPath[v][adjNode] < m_copyGraph.
weight(e)) {
977 bool changed =
false;
978 for (
node v = m_copyGraph.
firstNode(), nextV; v; v = nextV) {
981 if (m_copyIsTerminal[v]
982 || v->degree() != 2 ) {
987 edge eLeft = v->firstAdj()->theEdge();
988 edge eRight = v->lastAdj()->theEdge();
992 if (vLeft != vRight) {
993 T weight = m_copyGraph.
weight(eLeft) + m_copyGraph.
weight(eRight);
994 edge newEdge = m_copyGraph.
newEdge(vLeft, vRight, weight);
995 addNewEdge(newEdge, {v}, {eLeft, eRight},
true);
1004 template<
typename T>
1010 int componentWithTerminals = -1;
1011 for (
node v : m_copyTerminals) {
1012 if (componentWithTerminals != -1
1013 && hisConnectedComponent[v] != componentWithTerminals) {
1014 std::cerr <<
"terminals in different connected components!\n";
1017 componentWithTerminals = hisConnectedComponent[v];
1020 for (
node v = m_copyGraph.
firstNode(), nextV; v; v = nextV) {
1022 if (hisConnectedComponent[v] != componentWithTerminals) {
1030 template<
typename T>
1034 bool changed =
false;
1043 for (
edge e = m_copyGraph.
firstEdge(), nextE; e; e = nextE) {
1055 template<
typename T>
1061 distance[source] = 0;
1062 queue.
push(source, distance[source]);
1064 while (!queue.
empty()) {
1068 reachedNodes.
pushBack(currentNode);
1072 if (expandedEdges <= 0) {
1078 T possibleDistance = distance[currentNode] + m_copyGraph.
weight(e);
1080 if (m_eps.
geq(possibleDistance, maxDistance)
1081 || m_copyIsTerminal[adjacentNode]) {
1085 if (possibleDistance < distance[adjacentNode]) {
1086 distance[adjacentNode] = possibleDistance;
1087 if (queue.
contains(adjacentNode)) {
1088 queue.
decrease(adjacentNode, possibleDistance);
1090 queue.
push(adjacentNode, distance[adjacentNode]);
1097 template<
typename T>
1100 bool changed =
false;
1101 NodeArray<T> xDistance(m_copyGraph, std::numeric_limits<T>::max()),
1102 yDistance(m_copyGraph, std::numeric_limits<T>::max());
1104 for (
edge e = m_copyGraph.
firstEdge(), nextE; e; e = nextE) {
1111 for (
node commonNode : xReachedNodes) {
1112 if (yDistance[commonNode] == std::numeric_limits<T>::max()) {
1115 if (m_eps.
less(xDistance[commonNode] + yDistance[commonNode], m_copyGraph.
weight(e))) {
1122 for (
node reachedNode : xReachedNodes) {
1123 xDistance[reachedNode] = std::numeric_limits<T>::max();
1125 for (
node reachedNode : yReachedNodes) {
1126 yDistance[reachedNode] = std::numeric_limits<T>::max();
1132 template<
typename T>
1137 closestTerminals.init(m_copyGraph);
1138 NodePairQueue queue;
1139 std::unordered_map<NodePair, typename NodePairQueue::Handle, steiner_tree::UnorderedNodePairHasher, steiner_tree::UnorderedNodePairEquality> qpos;
1142 for (
node v : m_copyTerminals) {
1143 closestTerminals[v].pushBack(std::make_pair(v, 0));
1147 auto getCurrentDist = [&closestTerminals](
const node currentNode,
const node sourceTerminal) {
1148 for (std::pair<node,T> currentPair : closestTerminals[currentNode]) {
1149 if (currentPair.first == sourceTerminal) {
1150 return currentPair.second;
1153 return static_cast<T
>(-1);
1156 auto setNewDist = [&closestTerminals, k](
const node currentNode,
const node sourceTerminal,
const T newDist) {
1160 for (
ListIterator<std::pair<node, T>> it = currentList.
begin(); it.valid(); ++it) {
1161 if ((*it).first == sourceTerminal) {
1162 currentList.
del(it);
1167 if (currentList.
size() == k) {
1172 if (currentList.
empty()
1173 || (*currentList.
begin()).second >= newDist) {
1174 currentList.
pushFront(std::make_pair(sourceTerminal, newDist));
1179 while (it.
succ() != closestTerminals[currentNode].end()
1180 && (*it.
succ()).second < newDist) {
1183 closestTerminals[currentNode].insertAfter(std::make_pair(sourceTerminal, newDist), it);
1186 while (!queue.empty()) {
1187 NodePair minDistPair = queue.topElement();
1192 T currentDist = getCurrentDist(currentNode, sourceTerminal);
1193 if (currentDist == -1) {
1201 if (m_copyIsTerminal[adjacentNode]) {
1205 T possibleNewDistance = currentDist + m_copyGraph.
weight(e);
1208 T currentDistToAdjacentNode = getCurrentDist(adjacentNode, sourceTerminal);
1209 if (currentDistToAdjacentNode != -1) {
1210 if (possibleNewDistance < currentDistToAdjacentNode) {
1211 queue.decrease(qpos[
NodePair(adjacentNode, sourceTerminal)], possibleNewDistance);
1212 setNewDist(adjacentNode, sourceTerminal, possibleNewDistance);
1215 if (closestTerminals[adjacentNode].size() < k
1216 || closestTerminals[adjacentNode].back().second > possibleNewDistance) {
1217 qpos[
NodePair(adjacentNode, sourceTerminal)] = queue.push(
NodePair(adjacentNode, sourceTerminal), possibleNewDistance);
1218 setNewDist(adjacentNode, sourceTerminal, possibleNewDistance);
1225 template<
typename T>
1229 bool changed =
false;
1239 for (
edge e = m_copyGraph.
firstEdge(), nextE; e; e = nextE) {
1244 if (m_eps.
greater(m_copyGraph.
weight(e), bottleneckDistance)) {
1253 template<
typename T>
1256 if (m_copyTerminals.
size() <= 2) {
1260 bool changed =
false;
1272 for (
node v = m_copyGraph.
firstNode(), nextV; v; v = nextV) {
1275 if (m_copyIsTerminal[v]) {
1278 if (v->degree() <= 2
1279 || v->degree() > maxTestedDegree) {
1285 for (
adjEntry adj : v->adjEntries) {
1290 bool deleteNode =
true;
1291 for (neighborSubset.
begin(3, v->degree()); neighborSubset.
valid() && deleteNode; neighborSubset.
next()) {
1293 std::unordered_map<node, node> initNodeToAuxGraph;
1294 std::unordered_map<node, node> auxGraphToInitNode;
1296 T sumToSelectedAdjacentNodes = 0;
1298 for (
int i = 0; i < neighborSubset.
size(); ++i) {
1299 const adjEntry adj = neighborSubset[i];
1301 sumToSelectedAdjacentNodes += m_copyGraph.
weight(adj->
theEdge());
1303 OGDF_ASSERT(initNodeToAuxGraph.find(adjacentNode) == initNodeToAuxGraph.end());
1306 initNodeToAuxGraph[adjacentNode] = newAuxGraphNode;
1307 auxGraphToInitNode[newAuxGraphNode] = adjacentNode;
1311 for (
node auxGraphNode1 : auxGraph.
nodes) {
1312 for (
node auxGraphNode2 = auxGraphNode1->
succ(); auxGraphNode2; auxGraphNode2 = auxGraphNode2->
succ()) {
1313 edge e = auxGraph.
newEdge(auxGraphNode1, auxGraphNode2);
1315 auxGraphToInitNode[auxGraphNode1],
1316 auxGraphToInitNode[auxGraphNode2],
1317 tprime, tprimeHPD, closestTerminals);
1325 if (sumToSelectedAdjacentNodes < mstCost) {
1339 template<
typename T>
1342 isSuccessorOfMinCostEdge[currentNode] =
true;
1351 if (voronoiRegions.
predecessor(adjacentNode) == currentNode) {
1352 markSuccessors(adjacentNode, voronoiRegions, isSuccessorOfMinCostEdge);
1357 template<
typename T>
1368 if (first ==
nullptr 1375 if (second ==
nullptr 1384 template<
typename T>
1387 if (edgesToBeAddedInSolution.
empty()) {
1390 for (
edge e : edgesToBeAddedInSolution) {
1391 node x = e->source(), y = e->target();
1392 m_sonsList.emplace_back(std::vector<int>{m_nodeSonsListIndex[x], m_nodeSonsListIndex[y], m_edgeSonsListIndex[e]});
1393 m_costAlreadyInserted += m_copyGraph.
weight(e);
1395 m_nodeSonsListIndex[newNode] = (int)m_sonsList.
size() - 1;
1396 m_copyIsTerminal[newNode] =
true;
1403 template<
typename T>
1415 for (
node terminal : m_copyTerminals) {
1416 if (terminal->degree() >= 2) {
1423 for (
node terminal : m_copyTerminals) {
1424 if (terminal->degree() >= 2) {
1425 node closestNode = minCostIncidentEdge1[terminal]->opposite(terminal);
1427 if (voronoiRegions.seed(closestNode) == terminal) {
1428 markSuccessors(closestNode, voronoiRegions, isSuccessorOfMinCostEdge);
1434 NodeArray<T> distanceToClosestTerminal(m_copyGraph, std::numeric_limits<T>::max());
1437 node seedX = voronoiRegions.seed(x), seedY = voronoiRegions.seed(y);
1438 if (seedX != seedY) {
1440 T distanceThroughE = voronoiRegions.distance(x) + m_copyGraph.
weight(e) + voronoiRegions.distance(y);
1442 if (isSuccessorOfMinCostEdge[x]) {
1445 if (isSuccessorOfMinCostEdge[y]) {
1454 for (
node terminal : m_copyTerminals) {
1455 if (terminal->degree() >= 2) {
1456 const edge e = minCostIncidentEdge1[terminal];
1457 const node closestAdjacentNode = e->
opposite(terminal);
1458 T distance{voronoiRegions.seed(closestAdjacentNode) == terminal
1459 ? distanceToClosestTerminal[terminal]
1460 : m_copyGraph.
weight(e) + voronoiRegions.distance(closestAdjacentNode)};
1462 if (m_eps.
geq(m_copyGraph.
weight(minCostIncidentEdge2[terminal]), distance)
1463 && !willBeAddedInSolution[e]) {
1464 edgesToBeAddedInSolution.
pushBack(e);
1465 willBeAddedInSolution[e] =
true;
1473 template<
typename T>
1485 auto updateMinCostLeavingRegionsFor = [&](
node seed) {
1486 if (minCostLeavingRegionEdge1[seed] ==
nullptr 1487 || m_copyGraph.
weight(minCostLeavingRegionEdge1[seed]) > m_copyGraph.
weight(e)) {
1488 minCostLeavingRegionEdge2[seed] = minCostLeavingRegionEdge1[seed];
1489 minCostLeavingRegionEdge1[seed] = e;
1491 if (minCostLeavingRegionEdge2[seed] ==
nullptr 1492 || m_copyGraph.
weight(minCostLeavingRegionEdge2[seed]) > m_copyGraph.
weight(e)) {
1493 minCostLeavingRegionEdge2[seed] = e;
1497 const node seedX = voronoiRegions.seed(x), seedY = voronoiRegions.seed(y);
1498 if (seedX != seedY) {
1500 updateMinCostLeavingRegionsFor(seedX);
1501 updateMinCostLeavingRegionsFor(seedY);
1507 for (
node terminal : m_copyTerminals) {
1508 if (minCostLeavingRegionEdge2[terminal] ==
nullptr) {
1513 const edge e1 = minCostLeavingRegionEdge1[terminal];
1515 if (m_eps.
geq(m_copyGraph.
weight(minCostLeavingRegionEdge2[terminal]),
1516 voronoiRegions.distance(x) + m_copyGraph.
weight(e1) + voronoiRegions.distance(y))
1517 && !willBeAddedInSolution[e1]) {
1518 edgesToBeAddedInSolution.
pushBack(e1);
1519 willBeAddedInSolution[e1] =
true;
1526 template<
typename T>
1535 terminalRadius.
init(m_copyGraph, std::numeric_limits<T>::max());
1537 node seedV = voronoiRegions.seed(v);
1538 T distanceToSeedV = voronoiRegions.distance(v);
1544 if (voronoiRegions.seed(adjacentNode) != seedV) {
1551 template<
typename T>
1554 bool changed =
false;
1555 for (
node v = m_copyGraph.
firstNode(), nextV; v; v = nextV) {
1557 if (m_eps.
greater(lowerBoundWithNode[v], upperBound)) {
1566 template<
typename T>
1569 if (m_copyTerminals.
size() <= 1) {
1575 NodeArray<T> lowerBoundWithNode(m_copyGraph, std::numeric_limits<T>::lowest());
1584 if (m_copyIsTerminal[v]) {
1588 if (closestTerminals[v].size() < 2) {
1589 lowerBoundWithNode[v] = std::numeric_limits<T>::max();
1593 std::pair<node, T> closestTerminalPair1 = *(closestTerminals[v].get(0)), closestTerminalPair2 = *(closestTerminals[v].
get(1));
1594 T distanceToClosestTerminal1 = closestTerminalPair1.second, distanceToClosestTerminal2 = closestTerminalPair2.second;
1596 Math::updateMax(lowerBoundWithNode[v], distanceToClosestTerminal1 + distanceToClosestTerminal2 + radiusSum);
1604 T distanceToClosestTerminalX = (*closestTerminals[x].
begin()).second;
1605 T distanceToClosestTerminalY = (*closestTerminals[y].
begin()).second;
1607 Math::updateMax(lowerBoundWithEdge[e], m_copyGraph.
weight(e) + distanceToClosestTerminalX + distanceToClosestTerminalY + radiusSum);
1612 Graph auxiliaryGraph;
1614 for (
node terminal : m_copyTerminals) {
1615 node newAuxiliaryNode = auxiliaryGraph.newNode();
1616 terminalInAuxiliaryGraph[terminal] = newAuxiliaryNode;
1621 initialEdgeWeight[e] = m_copyGraph.
weight(e);
1623 Voronoi<T> voronoiRegions(m_copyGraph, initialEdgeWeight, m_copyTerminals);
1625 std::unordered_map<NodePair, edge, steiner_tree::UnorderedNodePairHasher, steiner_tree::UnorderedNodePairEquality> edgeBetweenNodes;
1626 EdgeArray<T> edgeWeight(auxiliaryGraph, std::numeric_limits<T>::max());
1629 node seedX = voronoiRegions.
seed(x), seedY = voronoiRegions.
seed(y);
1630 if (seedX == seedY) {
1634 auto pair =
NodePair(terminalInAuxiliaryGraph[seedX], terminalInAuxiliaryGraph[seedY]);
1635 if (edgeBetweenNodes.find(pair) == edgeBetweenNodes.end()) {
1636 edgeBetweenNodes[pair] = auxiliaryGraph.newEdge(terminalInAuxiliaryGraph[seedX], terminalInAuxiliaryGraph[seedY]);
1638 edge auxiliaryEdge = edgeBetweenNodes[pair];
1643 T minimumSpanningTreeCost =
computeMinST(auxiliaryGraph, edgeWeight, isInTree);
1644 T longestEdgeCost = std::numeric_limits<T>::lowest();
1645 for (
edge e : auxiliaryGraph.edges) {
1652 if (m_copyIsTerminal[v] || closestTerminals[v].size() < 2) {
1656 std::pair<node, T> closestTerminalPair1 = *(closestTerminals[v].get(0)), closestTerminalPair2 = *(closestTerminals[v].
get(1));
1657 T distanceToClosestTerminal1 = closestTerminalPair1.second, distanceToClosestTerminal2 = closestTerminalPair2.second;
1659 Math::updateMax(lowerBoundWithNode[v], minimumSpanningTreeCost - longestEdgeCost + distanceToClosestTerminal1 + distanceToClosestTerminal2);
1666 template<
typename T>
1669 bool changed =
false;
1670 if (m_copyTerminals.
size() > 1) {
1675 alg.
call(m_copyGraph, m_copyTerminals, lowerBoundNodes, lowerBoundEdges);
1683 template<
typename T>
1686 bool changed =
false;
1687 for (
edge e = m_copyGraph.
firstEdge(), nextE; e; e = nextE) {
1689 if (m_eps.
greater(lowerBoundWithEdge[e], upperBound)) {
1697 template<
typename T>
1705 T largestRadius1 = std::numeric_limits<T>::lowest(), largestRadius2 = std::numeric_limits<T>::lowest();
1706 for (
node terminal : m_copyTerminals) {
1707 radiusSum += terminalRadius[terminal];
1709 if (terminalRadius[terminal] > largestRadius1) {
1710 largestRadius2 = largestRadius1;
1711 largestRadius1 = terminalRadius[terminal];
1713 if (terminalRadius[terminal] > largestRadius2) {
1714 largestRadius2 = terminalRadius[terminal];
1718 radiusSum -= largestRadius1 + largestRadius2;
1722 template<
typename T>
1727 bool changed =
false;
1728 if (maxDegreeTest <= 0) {
1736 for (
node v : approximatedSteinerTree->
nodes) {
1737 isInUpperBoundTree[approximatedSteinerTree->
original(v)] =
true;
1739 delete approximatedSteinerTree;
1752 for (
node v = m_copyGraph.
firstNode(), nextV; v; v = nextV) {
1755 if (isInUpperBoundTree[v]
1756 || v->
degree() > maxDegreeTest) {
1765 dijkstra.
call(m_copyGraph, m_copyGraph.
edgeWeights(), v, predecessor, distance);
1768 node farthestTerminal =
nullptr;
1769 T distanceToFarthestTerminal(0);
1770 T distanceToClosestTerminal1 = std::numeric_limits<T>::max(),
1771 distanceToClosestTerminal2 = std::numeric_limits<T>::max();
1772 for (
node terminal : m_copyTerminals) {
1773 if (distanceToFarthestTerminal < distance[terminal]) {
1774 farthestTerminal = terminal;
1775 distanceToFarthestTerminal = distance[terminal];
1778 if (distanceToClosestTerminal1 > distance[terminal]) {
1779 distanceToClosestTerminal2 = distanceToClosestTerminal1;
1780 distanceToClosestTerminal1 = distance[terminal];
1782 if (distanceToClosestTerminal2 > distance[terminal]) {
1783 distanceToClosestTerminal2 = distance[terminal];
1788 if (predecessor[farthestTerminal] ==
nullptr 1789 || distanceToClosestTerminal2 == std::numeric_limits<T>::max()
1790 || m_eps.
geq(distanceToFarthestTerminal + distanceToClosestTerminal1 + distanceToClosestTerminal2, upperBoundCost)) {
1793 if (predecessor[farthestTerminal] !=
nullptr 1794 && distanceToClosestTerminal2 != std::numeric_limits<T>::max()
1795 && m_eps.
less(distanceToFarthestTerminal + distanceToClosestTerminal1, upperBoundCost)) {
1808 template<
typename T>
1809 template<
typename LAMBDA>
1815 distance.
init(m_copyGraph);
1817 dijkstra.
call(m_copyGraph, m_copyGraph.
edgeWeights(), v, predecessor, distance);
1819 for (
node terminal : m_copyTerminals) {
1820 if (predecessor[terminal] ==
nullptr) {
1824 if (optimalTerminal1 ==
nullptr 1825 || dist(optimalTerminal1, distance) > dist(terminal, distance)) {
1826 optimalTerminal2 = optimalTerminal1;
1827 optimalTerminal1 = terminal;
1829 if (optimalTerminal2 ==
nullptr 1830 || dist(optimalTerminal2, distance) > dist(terminal, distance)) {
1831 optimalTerminal2 = terminal;
1837 OGDF_ASSERT(optimalTerminal1 != optimalTerminal2);
1840 template<
typename T>
1843 if (m_copyTerminals.
size() <= 2) {
1852 for (
node v : approximatedSteinerTree->
nodes) {
1853 isInUpperBoundTree[approximatedSteinerTree->
original(v)] =
true;
1855 delete approximatedSteinerTree;
1858 NodeArray<T> minCostOfAdjacentEdge(m_copyGraph, std::numeric_limits<T>::max());
1859 for (
node terminal : m_copyTerminals) {
1860 for (
adjEntry adj : terminal->adjEntries) {
1863 cK += minCostOfAdjacentEdge[terminal];
1865 auto dist = [&minCostOfAdjacentEdge](
node terminal,
const NodeArray<T> &distance) {
1866 return distance[terminal] - minCostOfAdjacentEdge[terminal];
1870 std::set<edge> delEdges;
1873 for (
node v = m_copyGraph.
firstNode(), nextV; v; v = nextV) {
1876 if (isInUpperBoundTree[v]) {
1881 node vOptimalTerminal1 =
nullptr, vOptimalTerminal2 =
nullptr;
1885 if (m_eps.
geq(cK + dist(vOptimalTerminal1, vDistance) + dist(vOptimalTerminal2, vDistance), upperBoundCost)) {
1888 for (
adjEntry adj = v->firstAdj(), adjNext; adj; adj = adjNext) {
1889 adjNext = adj->succ();
1890 node w = adj->twinNode();
1891 if (m_copyIsTerminal[w]) {
1894 node wOptimalTerminal1 =
nullptr, wOptimalTerminal2 =
nullptr;
1897 node vOptimalTerminal = vOptimalTerminal1;
1898 node wOptimalTerminal = wOptimalTerminal1;
1899 if (vOptimalTerminal == wOptimalTerminal) {
1903 dist(vOptimalTerminal1, vDistance) + dist(wOptimalTerminal2, wDistance),
1904 dist(vOptimalTerminal2, vDistance) + dist(wOptimalTerminal1, wDistance))) {
1905 wOptimalTerminal = wOptimalTerminal2;
1907 vOptimalTerminal = vOptimalTerminal2;
1910 OGDF_ASSERT(vOptimalTerminal != wOptimalTerminal);
1911 if (m_eps.
geq(cK + dist(vOptimalTerminal, vDistance) + dist(wOptimalTerminal, wDistance) + m_copyGraph.
weight(adj->theEdge()), upperBoundCost)) {
1912 delEdges.insert(adj->theEdge());
1918 bool changed =
false;
1919 for (
edge e : delEdges) {
1923 for (
node v : delNodes) {
node target() const
Returns the target node of the edge.
void findClosestNonTerminals(node source, List< node > &reachedNodes, NodeArray< T > &distance, T maxDistance, int expandedEdges) const
Heuristic approach to computing the closest non-terminals for one node, such that there is no termina...
void clear()
Removes all elements from the list.
int operator()(NodePair const &v) const
static bool repeat(std::function< bool()> f)
Auxiliary function: Repeats a function until it returns false (used for iteratively applying reductio...
void pop()
Removes the topmost element from the queue.
The parameterized class Array implements dynamic arrays of type E.
T call(const EdgeWeightedGraph< T > &graph, const List< node > &terminals)
Calls the algorithm and returns the lower bound.
edge theEdge() const
Returns the edge associated with this adjacency entry.
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.
bool deleteNodesAboveUpperBound(const NodeArray< T > &lowerBoundWithNode, const T upperBound)
Deletes the nodes whose lowerBoundWithNode exceeds upperBound.
node copy(node v) const
Returns the node in the graph copy corresponding to v.
ListIteratorBase< E, isConst, isReverse > succ() const
Returns successor iterator.
Dijkstra's single source shortest path algorithm.
virtual void clear()
Removes all nodes and all edges from the graph.
node newNode(node vOrig)
Creates a new node in the graph copy with original node vOrig.
SteinerTreePreprocessing(const EdgeWeightedGraph< T > &wg, const List< node > &terminals, const NodeArray< bool > &isTerminal)
Implementation of a dual-ascent-based lower bound heuristic for Steiner tree problems.
void init()
Reinitializes the array. Associates the array with no graph.
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.
iterator pushBack(const E &x)
Adds element x at the end of the list.
Data type for general directed graphs (adjacency list representation).
virtual void delNode(node v)
Removes node v and all incident edges from the graph.
void push(const E &element, const P &priority)
Adds a new element to the queue.
void markSuccessors(node currentNode, const Voronoi< T > &voronoiRegions, NodeArray< bool > &isSuccessorOfMinCostEdge) const
Mark successors of currentNode in its shortest-path tree in voronoiRegions.
void init()
Reinitializes the array. Associates the array with no graph.
T computeMinST(const Graph &G, const EdgeArray< T > &weight, EdgeArray< bool > &isInTree)
Computes a minimum spanning tree using Prim's algorithm.
bool leastCostTest()
Performs a least cost test [DV89] computing the whole shortest path matrix.
void findTwoMinimumCostEdges(node v, edge &first, edge &second) const
Finds the first and second smallest edges incident to v.
virtual T call(const EdgeWeightedGraph< T > &G, const List< node > &terminals, const NodeArray< bool > &isTerminal, EdgeWeightedGraphCopy< T > *&finalSteinerTree)
Calls the Steiner tree algorithm for nontrivial cases but handles trivial cases directly.
Serves as an interface for various methods to compute or approximate minimum Steiner trees on undirec...
int degree() const
Returns the degree of the node (indegree + outdegree).
void call(const Graph &G, const EdgeArray< T > &weight, const List< node > &sources, NodeArray< edge > &predecessor, NodeArray< T > &distance, bool directed=false)
Calculates, based on the graph G with corresponding edge costs and source nodes, the shortest paths a...
edge newEdge(node u, node v, T weight)
Definition of the ogdf::steiner_tree:HeavyPathDecomposition class template.
iterator begin()
Returns an iterator to the first element of the list.
This class implements preprocessing strategies for the Steiner tree problem.
void setWeight(const edge e, T weight)
const EdgeArray< T > & edgeWeights() const
node firstNode() const
Returns the first node in the list of all nodes.
void computeClosestKTerminals(const int k, NodeArray< List< std::pair< node, T >>> &closestTerminals) const
Computes for every non-terminal the closest k terminals such that there is no other terminal on the p...
virtual void delEdge(edge e)
Removes edge e from the graph.
Implementation of Mehlhorn's minimum Steiner tree 2(1-1/l)-approximation algorithm.
int index() const
Returns the index of the edge.
Implementation of the 2(1-1/l)-approximation algorithm for the minimum Steiner tree problem by Matsuy...
void makeSimple(Graph &G)
Removes all self-loops and all but one edge of each bundle of parallel edges.
void addNewEdge(edge e, const std::vector< node > &replacedNodes, const std::vector< edge > &replacedEdges, bool deleteReplacedElements)
The function is called after a new edge is added to the copy graph during the reductions.
bool deleteLeaves()
Deletes the leaves of the graph.
List< node > m_copyTerminals
The reduced form of terminals.
bool valid() const
Checks if the current subset is valid. If not, the subset is either not initialized or all subsets ha...
A class used by the unordered_maps inside the reductions.
void addNewNode(node v, const std::vector< node > &replacedNodes, const std::vector< edge > &replacedEdges, bool deleteReplacedElements)
Calls addNew() for a node.
node succ() const
Returns the successor in the list of all nodes.
int connectedComponents(const Graph &G, NodeArray< int > &component, List< node > *isolated=nullptr)
Computes the connected components of G and optionally generates a list of isolated nodes...
void computeOptimalTerminals(node v, LAMBDA dist, node &optimalTerminal1, node &optimalTerminal2, NodeArray< T > &distance) const
Compute first and second best terminals according to function dist.
Defines a queue for handling prioritized elements.
void deleteSteinerDegreeTwoNode(node v, const EdgeWeightedGraphCopy< T > &tprime, const steiner_tree::HeavyPathDecomposition< T > &tprimeHPD, const NodeArray< List< std::pair< node, T >>> &closestTerminals)
Deletes a node that is known to have degree 2 in at least one minimum Steiner tree.
Prioritized queue interface wrapper for heaps.
std::unique_ptr< MinSteinerTreeModule< T > > m_costUpperBoundAlgorithm
Algorithm used for computing the upper bound for the cost of a minimum Steiner tree.
void popBack()
Removes the last element from the list.
bool nearestVertexTest()
Nearest vertex test using Voronoi regions [DV89, PV01].
bool longEdgesTest()
Long-Edges test from [DV89].
std::enable_if< std::is_integral< T >::value, bool >::type less(const T &x, const T &y) const
Compare if x is LESS than y for integral types.
edge searchEdge(node v, node w, bool directed=false) const
Searches and returns an edge connecting nodes v and w in time O( min(deg(v ), deg(w )))...
NodeArray< int > m_nodeSonsListIndex
It contains for each node an index i.
void del(iterator it)
Removes it from the list.
T weight(const edge e) const
const List< node > & getReducedTerminals() const
Returns the list of the terminals corresponding to the reduced graph.
bool dualAscentBasedTest(int repetitions=1)
Like dualAscentBasedTest(int repetitions, T upperBound) but the upper bound is computed by computeMin...
const List< node > & m_origTerminals
Const reference to the original list of terminals.
edge newEdge(node v, node w, T weight)
bool reduceFast()
Apply fast reductions iteratively (includes trivial reductions).
void append(const E &x)
Adds x at the end of queue.
void createEmpty(const Graph &wG)
void updateMin(T &min, const T &newValue)
Stores the minimum of min and newValue in min.
T computeMinSteinerTreeUpperBound(EdgeWeightedGraphCopy< T > *&finalSteinerTree) const
An implementation of the heavy path decomposition on trees.
internal::GraphObjectContainer< EdgeElement > edges
The container containing all edge objects.
const NodeArray< bool > & getReducedIsTerminal() const
Returns the NodeArray<bool> isTerminal corresponding to the reduced graph.
int numberOfEdges() const
Returns the number of edges in the graph.
Definition of the ogdf::SteinerTreeLowerBoundDualAscent class template.
Computes Voronoi regions in an edge-weighted graph.
const E & topElement() const
Returns the topmost element in the queue.
A class used by the unordered_maps inside the reductions.
iterator pushFront(const E &x)
Adds element x at the beginning of the list.
EdgeWeightedGraph< T > m_copyGraph
Copy of the original graph; this copy will actually be reduced.
void begin(int low, int high)
Initializes the SubsetEnumerator to enumerate subsets of cardinalities from low to high...
void addToSolution(const int listIndex, Array< bool, int > &isInSolution) const
Helper method for computeOriginalSolution.
edge firstEdge() const
Returns the first edge in the list of all edges.
INDEX size() const
Returns the size (number of elements) of the array.
void computeRadiusOfTerminals(NodeArray< T > &terminalRadius) const
Compute radius of terminals.
const_reference front() const
Returns a const reference to the first element.
bool terminalDistanceTest()
Simple terminal distance test [PV01].
bool shortLinksTest()
Short links test using Voronoi regions [PV01].
node contract(edge e)
Contracts edge e while preserving the order of adjacency entries.
Enumerator for k-subsets of a given type.
bool lowerBoundBasedTest()
Like lowerBoundBasedTest(T upperBound) but the upper bound is computed by computeMinSteinerTreeUpperB...
Doubly linked lists (maintaining the length of the list).
edge newEdge(node v, node w)
Creates a new edge (v,w) and returns it.
node seed(node v) const
Returns the Voronoi seed of node v.
T m_costAlreadyInserted
The cost of the already inserted in solution edges.
bool addEdgesToSolution(const List< edge > &edgesToBeAddedInSolution)
The function adds a set of edges in the solution.
T getBottleneckSteinerDistance(node x, node y) const
computes in the bottleneck distance between terminals x and y
bool PTmTest(const int k=3)
"Paths with many terminals" test, efficient on paths with many terminals.
void decrease(const E &element, const P &priority)
Decreases the priority of the given element.
bool isLoopFree(const Graph &G)
Returns true iff G contains no self-loop.
bool reduceFastAndDualAscent()
Apply fast reductions and the dual-ascent-based tests iteratively.
bool NTDkTest(const int maxTestedDegree=5, const int k=3)
Non-terminals of degree k test [DV89, PV01].
node twinNode() const
Returns the associated node of the corresponding adjacency entry (shorthand for twin()->theNode()).
Class for the representation of edges.
bool reduceTrivial()
Apply trivial (hence amazingly fast) reductions iteratively, that is degree2Test(), makeSimple(), deleteLeaves().
T computeRadiusSum() const
Compute the sum of all radii except the two largest.
T distance(node v) const
Returns the distance between v and its Voronoi seed.
adjEntry lastAdj() const
Returns the last entry in the adjacency list.
void setRepetitions(int num)
Sets the number of repeated calls to the lower bound algorithm (runs with different roots) ...
Class for the representation of nodes.
void computeOriginalSolution(const EdgeWeightedGraphCopy< T > &reducedGraphSolution, EdgeWeightedGraphCopy< T > &correspondingOriginalSolution)
Computes the solution for the original graph, given a solution on the reduction.
Encapsulates a pointer to a list element.
std::enable_if< std::is_integral< T >::value, bool >::type greater(const T &x, const T &y) const
Compare if x is GREATER than y for integral types.
bool reachabilityTest(int maxDegreeTest=0, const int k=3)
Performs a reachability test [DV89].
node opposite(node v) const
Returns the adjacent node different from v.
const NodeArray< bool > & m_origIsTerminal
Const reference to the original isTerminal.
void addNew(TWhat x, const std::vector< node > &replacedNodes, const std::vector< edge > &replacedEdges, bool deleteReplacedElements, TWhatArray &whatSonsListIndex)
Update internal data structures to let a (new) node or edge represent replaced nodes and/or edges...
const Graph & original() const
Returns a reference to the original graph.
bool degree2Test()
deletes degree-2 nodes and replaces them with one edge with the adjacent edges' sum ...
void floydWarshall(NodeArray< NodeArray< T >> &shortestPath) const
Applies the Floyd-Warshall algorithm on the m_copyGraph. The shortestPath matrix has to be already in...
This class implements the minimum Steiner tree 2-approximation algorithm by Takahashi and Matsuyama w...
bool isSimpleUndirected(const Graph &G)
Returns true iff G contains neither self-loops nor undirected parallel edges.
NodeArray< bool > m_copyIsTerminal
The reduced form of isTerminal.
const EdgeWeightedGraph< T > & m_origGraph
Const reference to the original graph.
std::vector< std::vector< int > > m_sonsList
List with lists (corresponding to nodes and containing the indexes of their sons) ...
int index() const
Returns the (unique) node index.
EdgeArray< int > m_edgeSonsListIndex
See m_nodeSonsListIndex but for edges.
edge succ() const
Returns the successor in the list of all edges.
bool empty() const
Checks whether the queue is empty.
bool deleteComponentsWithoutTerminals()
Deletes connected components with no terminals.
void next()
Obtains the next subset if possible. The result should be checked using the valid() method...
adjEntry succ() const
Returns the successor in the adjacency list.
T computeMinSteinerTreeUpperBound() const
int size() const
Returns the number of elements in the list.
bool makeSimple()
Deletes parallel edges keeping only the minimum cost one, and deletes self-loops. ...
T constructTerminalSpanningTreeUsingVoronoiRegions(EdgeWeightedGraphCopy< T > &terminalSpanningTree, const EdgeWeightedGraph< T > &graph, const List< node > &terminals)
iterator begin()
Returns an iterator to the first entry in the node array.
int maxNodeIndex() const
Returns the largest used node index.
void recomputeTerminalsList()
Used by reductions to recompute the m_copyTerminals list, according to m_copyIsTerminal; useful when ...
bool contains(const E &element) const
Returns whether this queue contains that key.
node predecessor(node v) const
Returns the nearest node to v on the shortest path to its Voronoi seed.
node source() const
Returns the source node of the edge.
T solve(MinSteinerTreeModule< T > &mst, EdgeWeightedGraphCopy< T > *&finalSteinerTree)
A shortcut to get the solution of a reduced instance.
bool cutReachabilityTest()
Performs a cut reachability test [DV89].
T computeBottleneckDistance(node x, node y, const EdgeWeightedGraphCopy< T > &tprime, const steiner_tree::HeavyPathDecomposition< T > &tprimeHPD, const NodeArray< List< std::pair< node, T >>> &closestTerminals) const
Heuristic computation [PV01] of the bottleneck Steiner distance between two nodes in a graph...
int size() const
Returns the cardinality of the subset.
The namespace for all OGDF objects.
Declaration and implementation of bounded queue class.
int maxEdgeIndex() const
Returns the largest used edge index.
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.
bool deleteEdgesAboveUpperBound(const EdgeArray< T > &lowerBoundWithEdge, const T upperBound)
Deletes the edges whose lowerBoundWithEdge exceeds upperBound.
int numberOfNodes() const
Returns the number of nodes in the graph.
Handle push(const E &element, const P &priority)
Pushes a new element with the respective priority to the queue.
node newNode()
Creates a new node and returns it.
void updateMax(T &max, const T &newValue)
Stores the maximum of max and newValue in max.
internal::GraphObjectContainer< NodeElement > nodes
The container containing all node objects.
adjEntry firstAdj() const
Returns the first entry in the adjaceny list.
bool isConnected(const Graph &G)
Returns true iff G is connected.
ListConstIterator< E > search(const E &e) const
Scans the list for the specified element and returns an iterator to the first occurrence in the list...
void computeShortestPathMatrix(NodeArray< NodeArray< T >> &shortestPath) const
Computes the shortest path matrix corresponding to the m_copyGraph.
void shuffleReducedTerminals()
Shuffles the list of reduced terminals. This can have an effect on some tests.
A class that allows to enumerate k-subsets.
bool empty() const
Returns true iff the list is empty.
bool empty() const
Returns true iff the graph is empty, i.e., contains no nodes.
The parameterized class BoundedQueue implements queues with bounded size.
Class for adjacency list elements.
void permute()
Randomly permutes the elements in the list.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
T weight(const edge e) const
bool dualAscentBasedTest(int repetitions, T upperBound)
Like lowerBoundBasedTest(T upperBound) but uses ogdf::SteinerTreeLowerBoundDualAscent to compute lowe...
internal::GraphObjectContainer< AdjElement > adjEntries
The container containing all entries in the adjacency list of this node.