96template<
class T,
class Y>
385template<
class T,
class Y>
409 checkLeaf->getNodeInfo()->userStructInfo()->m_notVisitedCount = 1;
438 cleanUp.pushBack(
nodePtr->parent());
441 nodePtr->parent()->getNodeInfo()->userStructInfo()->m_notVisitedCount++;
442 int childCount =
nodePtr->parent()->pertChildCount();
443 nodePtr->parent()->pertChildCount(++childCount);
461 for (
itn = cleanUp.begin();
itn.valid(); ++
itn) {
468template<
class T,
class Y>
471 delete nodePtr->getNodeInfo()->userStructInfo();
476template<
class T,
class Y>
490template<
class T,
class Y>
494 while (!cleanUp.empty()) {
495 nodePtr = cleanUp.popFrontRet();
507 nodePtr->getNodeInfo()->userStructInfo()->m_notVisitedCount = 0;
508 nodePtr->getNodeInfo()->userStructInfo()->m_pertLeafCount = 0;
513 for (it = this->m_pertinentNodes->begin(); it.
valid(); ++it) {
517 eliminatedNodes.pushBack(
nodePtr);
522 }
else if (
nodePtr->getNodeInfo()) {
523 nodePtr->getNodeInfo()->userStructInfo()->defaultValues();
529template<
class T,
class Y>
557 checkLeaf->getNodeInfo()->userStructInfo()->m_pertLeafCount = 1;
558 checkLeaf->getNodeInfo()->userStructInfo()->m_notVisitedCount--;
578 nodePtr->parent()->getNodeInfo()->userStructInfo()->m_pertLeafCount =
579 nodePtr->parent()->getNodeInfo()->userStructInfo()->m_pertLeafCount
580 +
nodePtr->getNodeInfo()->userStructInfo()->m_pertLeafCount;
581 nodePtr->parent()->getNodeInfo()->userStructInfo()->m_notVisitedCount--;
582 if (!
nodePtr->parent()->getNodeInfo()->userStructInfo()->m_notVisitedCount) {
590 nodePtr->getNodeInfo()->userStructInfo()->m_w = 1;
591 nodePtr->getNodeInfo()->userStructInfo()->m_h = 0;
592 nodePtr->getNodeInfo()->userStructInfo()->m_a = 0;
600 nodePtr->getNodeInfo()->userStructInfo()->m_w = sumPertChild(
nodePtr);
610 nodePtr->getNodeInfo()->userStructInfo()->m_h = 0;
611 nodePtr->getNodeInfo()->userStructInfo()->m_a = 0;
638 this->m_pertinentRoot =
nodePtr;
639 if (this->m_pertinentRoot->getNodeInfo()->userStructInfo()->m_h
640 <
this->m_pertinentRoot->getNodeInfo()->userStructInfo()->m_a) {
647 if (this->m_pertinentRoot->getNodeInfo()->userStructInfo()->m_h
648 <
this->m_pertinentRoot->getNodeInfo()->userStructInfo()->m_a) {
649 this->m_pertinentRoot->getNodeInfo()->userStructInfo()->m_deleteType =
whaType::H;
651 this->m_pertinentRoot->getNodeInfo()->userStructInfo()->m_deleteType =
whaType::A;
660template<
class T,
class Y>
692 this->m_pertinentNodes->pushFront(
nodePtr);
704 this->m_pertinentNodes->pushFront(
nodePtr);
714 switch (
nodePtr->getNodeInfo()->userStructInfo()->m_deleteType) {
716 this->m_pertinentNodes->pushFront(
nodePtr);
722 this->m_pertinentNodes->pushFront(
nodePtr);
737 if (
nodePtr->getNodeInfo()->userStructInfo()->m_hChild1) {
741 if (
hChild1->getNodeInfo()->userStructInfo()->m_h
742 <
hChild1->getNodeInfo()->userStructInfo()->m_w) {
747 - partialChildren(
nodePtr)->size());
762 this->m_pertinentNodes->pushFront(
nodePtr);
790 if (
nodePtr->getNodeInfo()->userStructInfo()->m_aChild) {
799 if (
nodePtr->getNodeInfo()->userStructInfo()->m_hChild1) {
804 if (
hChild1->getNodeInfo()->userStructInfo()->m_h
805 <
hChild1->getNodeInfo()->userStructInfo()->m_w) {
809 if (
nodePtr->getNodeInfo()->userStructInfo()->m_hChild2) {
814 if (
hChild2->getNodeInfo()->userStructInfo()->m_h
815 <
hChild2->getNodeInfo()->userStructInfo()->m_w) {
820 - partialChildren(
nodePtr)->size());
846 if (
nodePtr->getNodeInfo()->userStructInfo()->m_aChild) {
863 this->m_pertinentNodes->pushFront(
nodePtr);
873 fullChildren(
nodePtr)->clear();
874 partialChildren(
nodePtr)->clear();
876 nodePtr->getNodeInfo()->userStructInfo()->m_hChild1 =
nullptr;
877 nodePtr->getNodeInfo()->userStructInfo()->m_hChild2 =
nullptr;
878 nodePtr->getNodeInfo()->userStructInfo()->m_aChild =
nullptr;
879 nodePtr->getNodeInfo()->userStructInfo()->m_w = 0;
880 nodePtr->getNodeInfo()->userStructInfo()->m_h = 0;
881 nodePtr->getNodeInfo()->userStructInfo()->m_a = 0;
886template<
class T,
class Y>
928 if ((
currentNode->getNodeInfo()->userStructInfo()->m_pertLeafCount
929 -
currentNode->getNodeInfo()->userStructInfo()->m_h)
943template<
class T,
class Y>
971 if (
currentNode->getNodeInfo()->userStructInfo()->m_w
972 -
currentNode->getNodeInfo()->userStructInfo()->m_h
996 if ((
currentNode->getNodeInfo()->userStructInfo()->m_w
997 -
currentNode->getNodeInfo()->userStructInfo()->m_h)
1018template<
class T,
class Y>
1031 for (it = partialChildren(
nodePtr)->begin(); it.
valid(); ++it) {
1032 (*it)->getNodeInfo()->userStructInfo()->m_deleteType =
deleteType;
1034 for (it = fullChildren(
nodePtr)->begin(); it.
valid(); ++it) {
1035 (*it)->getNodeInfo()->userStructInfo()->m_deleteType =
deleteType;
1039 for (it = partialChildren(
nodePtr)->begin(); it.
valid(); ++it) {
1040 (*it)->getNodeInfo()->userStructInfo()->m_deleteType =
deleteType;
1046 for (it = fullChildren(
nodePtr)->begin(); it.
valid(); ++it) {
1047 (*it)->getNodeInfo()->userStructInfo()->m_deleteType =
deleteType;
1052template<
class T,
class Y>
1093 for (it = partialChildren(
nodePtr)->begin(); it.
valid(); ++it) {
1097 -
currentNode->getNodeInfo()->userStructInfo()->m_h;
1133 nodePtr->getNodeInfo()->userStructInfo()->m_aChild =
aChild;
1136 nodePtr->getNodeInfo()->userStructInfo()->m_aChild =
nullptr;
1140template<
class T,
class Y>
1152template<
class T,
class Y>
1210 -
leftChild->getNodeInfo()->userStructInfo()->m_h;
1242 -
rightChild->getNodeInfo()->userStructInfo()->m_h;
1267 nodePtr->getNodeInfo()->userStructInfo()->m_hChild1 =
nullptr;
1277template<
class T,
class Y>
1386 -
currentNode->getNodeInfo()->userStructInfo()->m_h;
1416 -
currentNode->getNodeInfo()->userStructInfo()->m_h;
1462 -
currentNode->getNodeInfo()->userStructInfo()->m_h;
1490 nodePtr->getNodeInfo()->userStructInfo()->m_aChild =
nullptr;
1493 nodePtr->getNodeInfo()->userStructInfo()->m_hChild2 =
nullptr;
1494 nodePtr->getNodeInfo()->userStructInfo()->m_hChild2Sib =
nullptr;
1495 nodePtr->getNodeInfo()->userStructInfo()->m_aChild =
aChild;
1499template<
class T,
class Y>
1521 for (it = fullChildren(
nodePtr)->begin(); it.
valid(); ++it) {
1525 -
currentNode->getNodeInfo()->userStructInfo()->m_a;
1532 for (it = partialChildren(
nodePtr)->begin(); it.
valid(); ++it) {
1536 -
currentNode->getNodeInfo()->userStructInfo()->m_a;
1545template<
class T,
class Y>
1558 for (it = fullChildren(
nodePtr)->begin(); it.
valid(); ++it) {
1559 sum =
sum + (*it)->getNodeInfo()->userStructInfo()->m_w;
1561 for (it = partialChildren(
nodePtr)->begin(); it.
valid(); ++it) {
1562 sum =
sum + (*it)->getNodeInfo()->userStructInfo()->m_w;
1568template<
class T,
class Y>
1570 if (
nodePtr->parent() ==
nullptr) {
1589 while (!
L.empty()) {
Includes declaration of graph class.
Declaration and implementation of the class PQTree.
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
Encapsulates a pointer to a list element.
bool valid() const
Returns true iff the iterator points to an element.
The class template MaxSequencePQTree is designed to compute a maximal consecutive sequence of pertine...
int determineMinRemoveSequence(SListPure< PQLeafKey< T, whaInfo *, Y > * > &leafKeys, SList< PQLeafKey< T, whaInfo *, Y > * > &eliminatedKeys)
Computes the maximal pertinent sequence S' of elements of the set S, that can be reduced in a PQ-tree...
void markPertinentChildren(PQNode< T, whaInfo *, Y > *nodePtr, PQNodeRoot::PQNodeStatus label, whaType deleteType)
Marks all full and/or partial children of nodePtr as either an a-, b-, h- or w-node.
PQNode< T, whaInfo *, Y > * GetParent(PQNode< T, whaInfo *, Y > *nodePtr)
Computes for the node nodePtr its valid parent in the PQ-tree.
void aNumQnode(PQNode< T, whaInfo *, Y > *nodePtr, int sumAllW)
Computes the a-number of the partial Q-node nodePtr.
void findMinWHASequence(ArrayBuffer< PQNode< T, whaInfo *, Y > * > &archiv, SList< PQLeafKey< T, whaInfo *, Y > * > &eliminatedKeys)
Checks the [w,h,a]-number of the pertinent root.
SListPure< PQNode< T, whaInfo *, Y > * > eliminatedNodes
Used to store all eliminated nodes (status == PQNodeRoot::PQNodeStatus::Eliminated) of the PQTree.
int alpha1beta1Number(PQNode< T, whaInfo *, Y > *nodePtr, PQNode< T, whaInfo *, Y > **aChild)
Returns alpha_1 = beta_1 = sum_{i in P(nodePtr)} w_i - max_{i in P(nodePtr)}{(w_i = a_i)},...
virtual void CleanNode(PQNode< T, whaInfo *, Y > *nodePtr)
Frees the memory allocated for the node information class of a node in the PQTree.
int sumPertChild(PQNode< T, whaInfo *, Y > *nodePtr)
Returns w = sum_{i in P(nodePtr)}w_i, where nodePtr is any pertinent node of the PQ-tree.
SListPure< PQNode< T, whaInfo *, Y > * > cleanUp
Used to store all pertinent Nodes of the pertinent subtree before removing the minimal pertinent subs...
void haNumQnode(PQNode< T, whaInfo *, Y > *nodePtr)
Computes the h- and a-number of the partial Q-node nodePtr.
virtual bool Bubble(SListPure< PQLeafKey< T, whaInfo *, Y > * > &leafKeys)
The function Bubble() is an overloaded function of the base template class PQTree.
int setAchildren(PQNode< T, whaInfo *, Y > *hChild2, PQNode< T, whaInfo *, Y > *hChild2Sib)
Traces all children of the largest consecutive sequence of pertinent children of a Q-node.
int setHchild(PQNode< T, whaInfo *, Y > *hChild1)
Processes the children of a Q-node, marking a full sequence of children with at most incident partial...
virtual void emptyAllPertinentNodes()
Does a clean up after a reduction.
void hNumQnode(PQNode< T, whaInfo *, Y > *nodePtr, int sumAllW)
Computes the h-number of the partial Q-node nodePtr.
void haNumPnode(PQNode< T, whaInfo *, Y > *nodePtr)
Computes the h- and a-number of a P-node nodePtr.
virtual void clientDefinedEmptyNode(PQNode< T, whaInfo *, Y > *nodePtr)
Does a clean up of a node. Called by emptyAllPertinentNodes.
The class template PQLeafKey is a derived class of class template PQBasicKey.
The class template PQBasicKey is an abstract base class.
The class template PQNodeKey is a derived class of class template PQBasicKey.
@ Eliminated
Nodes removed during the template reduction are marked as as Eliminated. Their memory is not freed....
@ WhaDelete
Nodes that need to be removed in order to obtain a maximal pertinent sequence are marked WhaDelete.
@ PertRoot
The pertinent Root is marked PertRoot during the clean up after a reduction. Technical.
List< PQNode< T, whaInfo *, Y > * > * partialChildren(PQNode< T, whaInfo *, Y > *nodePtr)
void emptyNode(PQNode< T, whaInfo *, Y > *nodePtr)
Cleans up all stacks, flags and pointers of a pertinent node that has been visited during the reducti...
virtual void emptyAllPertinentNodes()
Cleans up all flags that have been set in the pertinent nodes during the reduction process.
List< PQNode< T, whaInfo *, Y > * > * fullChildren(PQNode< T, whaInfo *, Y > *nodePtr)
The parameterized class Queue<E> implements list-based queues.
Singly linked lists (maintaining the length of the list).
Encapsulates a pointer to an ogdf::SList element.
bool valid() const
Returns true iff the iterator points to an element.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
whaType
The definitions for W, B, H and A describe the type of a node during the computation of the maximal p...
Declaration of class whaInfo.