// Overloads virtual function of base class PQTree // Allows ignoring the virtual direction indicators during // the template matching algorithm. PQNode<edge,indInfo*,bool>* EmbedPQTree::clientRightEndmost( PQNode<edge,indInfo*,bool> *nodePtr) const { PQNode<edge,indInfo*,bool> *right = PQTree<edge,indInfo*,bool>::clientRightEndmost(nodePtr); if (!right || right->status() != INDICATOR) return right; else return clientNextSib(right,NULL); }
// Overloads virtual function of base class PQTree // Allows ignoring the virtual direction indicators during // the template matching algorithm. PQNode<edge,indInfo*,bool>* EmbedPQTree::clientLeftEndmost( PQNode<edge,indInfo*,bool> *nodePtr) const { PQNode<edge,indInfo*,bool> *left = PQTree<edge,indInfo*,bool>::clientLeftEndmost(nodePtr); if (!left || left->status() != INDICATOR) return left; else return clientNextSib(left,NULL); }
// Overloads virtual function of base class PQTree // Allows ignoring the virtual direction indicators during // the template matching algorithm. PQNode<edge,IndInfo*,bool>* EmbedPQTree::clientRightEndmost( PQNode<edge,IndInfo*,bool> *nodePtr) const { PQNode<edge,IndInfo*,bool> *right = PQTree<edge,IndInfo*,bool>::clientRightEndmost(nodePtr); if (!right || right->status() != PQNodeRoot::PQNodeStatus::Indicator) return right; else return clientNextSib(right,nullptr); }
// Overloads virtual function of base class PQTree // Allows ignoring the virtual direction indicators during // the template matching algorithm. PQNode<edge,IndInfo*,bool>* EmbedPQTree::clientLeftEndmost( PQNode<edge,IndInfo*,bool> *nodePtr) const { PQNode<edge,IndInfo*,bool> *left = PQTree<edge,IndInfo*,bool>::clientLeftEndmost(nodePtr); if (!left || left->status() != PQNodeRoot::PQNodeStatus::Indicator) return left; else return clientNextSib(left,nullptr); }
void EmbedPQTree::ReplacePartialRoot( SListPure<PlanarLeafKey<indInfo*>*> &leafKeys, SListPure<PQBasicKey<edge,indInfo*,bool>*> &frontier, node v) { m_pertinentRoot->childCount(m_pertinentRoot->childCount() + 1 - fullChildren(m_pertinentRoot)->size()); PQNode<edge,indInfo*,bool> *predNode = 0; // dummy PQNode<edge,indInfo*,bool> *beginSequence = 0; // marks begin consecuitve seqeunce PQNode<edge,indInfo*,bool> *endSequence = 0; // marks end consecutive sequence PQNode<edge,indInfo*,bool> *beginInd = 0; // initially, marks direct sibling indicator // next to beginSequence not contained // in consectuive sequence // Get beginning and end of sequence. while (fullChildren(m_pertinentRoot)->size()) { PQNode<edge,indInfo*,bool> *currentNode = fullChildren(m_pertinentRoot)->popFrontRet(); if (!clientSibLeft(currentNode) || clientSibLeft(currentNode)->status() == EMPTY) { if (!beginSequence) { beginSequence = currentNode; predNode = clientSibLeft(currentNode); beginInd =PQTree<edge,indInfo*,bool>::clientSibLeft(currentNode); } else endSequence = currentNode; } else if (!clientSibRight(currentNode) || clientSibRight(currentNode)->status() == EMPTY ) { if (!beginSequence) { beginSequence = currentNode; predNode = clientSibRight(currentNode); beginInd =PQTree<edge,indInfo*,bool>::clientSibRight(currentNode); } else endSequence = currentNode; } } SListPure<PQBasicKey<edge,indInfo*,bool>*> partialFrontier; // Now scan the sequence of full nodes. Remove all of them but the last. // Call ReplaceFullRoot on the last one. // For every full node get its frontier. Scan intermediate indicators. PQNode<edge,indInfo*,bool> *currentNode = beginSequence; while (currentNode != endSequence) { PQNode<edge,indInfo*,bool>* nextNode = clientNextSib(currentNode,predNode); front(currentNode,partialFrontier); frontier.conc(partialFrontier); PQNode<edge,indInfo*,bool>* currentInd = PQTree<edge,indInfo*,bool>:: clientNextSib(currentNode,beginInd); // Scan for intermediate direction indicators. while (currentInd != nextNode) { PQNode<edge,indInfo*,bool> *nextInd = PQTree<edge,indInfo*,bool>:: clientNextSib(currentInd,currentNode); if (currentNode == currentInd->getSib(RIGHT)) //Direction changed currentInd->getNodeInfo()->userStructInfo()->changeDir = true; frontier.pushBack((PQBasicKey<edge,indInfo*,bool>*) currentInd->getNodeInfo()); removeChildFromSiblings(currentInd); m_pertinentNodes->pushBack(currentInd); currentInd = nextInd; } removeChildFromSiblings(currentNode); currentNode = nextNode; } currentNode->parent(m_pertinentRoot); m_pertinentRoot = currentNode; ReplaceFullRoot(leafKeys,partialFrontier,v,true,beginInd); frontier.conc(partialFrontier); }