// initialize the nodes of the outer face // and the corresponding faces void ComputeTricOrder::initOuterNodes(node v1, node v2){ // set nodes v1 and v2 on the "base" m_v1 = v1; m_v2 = v2; adjEntry firstAdj = m_outerFace->firstAdj(); // set firstAdj, so outerface is on the right if (m_pEmbedding->rightFace(firstAdj) == m_outerFace) firstAdj = firstAdj->cyclicSucc(); adjEntry adjRun = firstAdj; // traverse all nodes of the outer face do { node v = adjRun->theNode(); // now traverse the faces f of v // and increase outv[f] and add v to outerNodes[f] for(adjEntry adjV : v->adjEntries){ face f = m_pEmbedding->rightFace(adjV); if (f != m_outerFace){ m_outv[f]++; m_outerNodes[f].pushBack(v); } } adjRun = adjRun->twin()->cyclicSucc(); } while (adjRun != firstAdj); }
// initialize the edges of the external face // and the corresponding faces void ComputeTricOrder::initOuterEdges() { adjEntry firstAdj = m_outerFace->firstAdj(); // set firstAdj, so outerface is on the right if (m_pEmbedding->rightFace(firstAdj) == m_outerFace) firstAdj = firstAdj->cyclicSucc(); adjEntry adjRun = firstAdj; // traverse all edges of the outer face do { edge e = adjRun->theEdge(); face f = m_pEmbedding->rightFace(adjRun); // verify that actual edge is not edge (v1,v2) if (!((e->source() == m_v1 && e->target() == m_v2) || ((e->source() == m_v2 && e->target() == m_v1)))){ m_oute[f]++; m_outerEdges[f].pushBack(e); } adjRun = adjRun->twin()->cyclicSucc(); } while (adjRun != firstAdj); }
void ExpandedGraph2::constructDual(node s, node t, GraphCopy &GC, const EdgeArray<bool> *forbiddenEdgeOrig) { m_dual.clear(); FaceArray<node> faceNode(m_E); // constructs nodes (for faces in exp) face f; forall_faces(f,m_E) { faceNode[f] = m_dual.newNode(); } // construct dual edges (for primal edges in exp) node v; forall_nodes(v,m_exp) { adjEntry adj; forall_adj(adj,v) { // cannot cross edges that does not correspond to real edges adjEntry adjG = m_expToG[adj]; if(adjG == 0) continue; // Do not insert edges into dual if crossing the original edge // is forbidden if(forbiddenEdgeOrig && (*forbiddenEdgeOrig)[GC.original(m_BC.dynamicSPQRForest().original(m_expToG[adj]->theEdge()))] == true) continue; node vLeft = faceNode[m_E.leftFace (adj)]; node vRight = faceNode[m_E.rightFace(adj)]; m_primalEdge[m_dual.newEdge(vLeft,vRight)] = adj; }
void ExpandedGraph2::expand(node v, node vPred, node vSucc) { m_exp.clear(); while (!m_nodesG.empty()) m_GtoExp[m_nodesG.popBackRet()] = 0; edge eInS = 0; if (vPred != 0) { eInS = m_BC.dynamicSPQRForest().virtualEdge(vPred,v); m_eS = insertEdge(eInS->source(),eInS->target(),0); } edge eOutS = 0; if (vSucc != 0) { eOutS = m_BC.dynamicSPQRForest().virtualEdge(vSucc,v); m_eT = insertEdge(eOutS->source(),eOutS->target(),0); } expandSkeleton(v, eInS, eOutS); PlanarModule pm; pm.planarEmbed(m_exp); m_E.init(m_exp); }