예제 #1
0
int  _IsolateOuterplanarityObstructionE3orE4(graphP theGraph)
{
isolatorContextP IC = &theGraph->IC;
int u, d, XorY;

/* Minor E3 */

     if (FUTUREPERTINENT(theGraph, theGraph->IC.x, theGraph->IC.v) ||
         FUTUREPERTINENT(theGraph, theGraph->IC.y, theGraph->IC.v))
     {
         if (_MarkHighestXYPath(theGraph) != TRUE)
             return NOTOK;

         if (FUTUREPERTINENT(theGraph, theGraph->IC.x, theGraph->IC.v))
              XorY = theGraph->IC.x;
         else XorY = theGraph->IC.y;

         /* The cases of X externally active and Y externally active
                are the same except for the bicomp external face marking
                (because parameter order is important) */

         if (XorY == theGraph->IC.x)
         {
             if (_MarkPathAlongBicompExtFace(theGraph, IC->x, IC->w) != OK ||
                 _MarkPathAlongBicompExtFace(theGraph, IC->y, IC->r) != OK)
                 return NOTOK;
         }
         else
         {
             if (_MarkPathAlongBicompExtFace(theGraph, IC->r, IC->x) != OK ||
                 _MarkPathAlongBicompExtFace(theGraph, IC->w, IC->y) != OK)
                 return NOTOK;
         }

         if (_FindUnembeddedEdgeToCurVertex(theGraph, IC->w, &IC->dw) != TRUE)
             return NOTOK;

         if (_FindUnembeddedEdgeToAncestor(theGraph, XorY, &u, &d) != TRUE)
             return NOTOK;

         if (theGraph->functions.fpMarkDFSPath(theGraph, u, IC->v) != OK ||
             theGraph->functions.fpMarkDFSPath(theGraph, XorY, d) != OK ||
             theGraph->functions.fpMarkDFSPath(theGraph, IC->w, IC->dw) != OK ||
             _JoinBicomps(theGraph) != OK ||
             _AddAndMarkEdge(theGraph, u, d) != OK ||
             _AddAndMarkEdge(theGraph, IC->v, IC->dw) != OK)
             return NOTOK;

         return OK;
     }

/* Otherwise, isolate Minor E4 (reduce to minor A) */

     if (_FindUnembeddedEdgeToAncestor(theGraph, IC->w, &u, &d) != TRUE)
         return NOTOK;

     IC->v = u;
     IC->dw = d;
     return _IsolateOuterplanarityObstructionA(theGraph);
}
예제 #2
0
int  _InitializeIsolatorContext(graphP theGraph)
{
    isolatorContextP IC = &theGraph->IC;

    /* Obtains the edges connecting X and Y to ancestors of the current vertex */

    if (_FindUnembeddedEdgeToAncestor(theGraph, IC->x, &IC->ux, &IC->dx) != TRUE ||
            _FindUnembeddedEdgeToAncestor(theGraph, IC->y, &IC->uy, &IC->dy) != TRUE)
        return NOTOK;

    /* For Minor B, we seek the last pertinent child biconnected component, which
         is also future pertinent, and obtain the DFS child in its root edge.
         This child is the subtree root containing vertices with connections to
         both the current vertex and an ancestor of the current vertex. */

    if (theGraph->IC.minorType & MINORTYPE_B)
    {
        int SubtreeRoot = gp_GetVertexLastPertinentRootChild(theGraph, IC->w);

        IC->uz = gp_GetVertexLowpoint(theGraph, SubtreeRoot);

        if (_FindUnembeddedEdgeToSubtree(theGraph, IC->v, SubtreeRoot, &IC->dw) != TRUE ||
                _FindUnembeddedEdgeToSubtree(theGraph, IC->uz, SubtreeRoot, &IC->dz) != TRUE)
            return NOTOK;
    }

    /* For all other minors, we obtain an unembedded connecting the current vertex to the
     	 pertinent vertex W, and for minor E we collect the additional unembedded ancestor
     	 connection for the future pertinent vertex Z. */

    else
    {
        if (_FindUnembeddedEdgeToCurVertex(theGraph, IC->w, &IC->dw) != TRUE)
            return NOTOK;

        if (theGraph->IC.minorType & MINORTYPE_E)
            if (_FindUnembeddedEdgeToAncestor(theGraph, IC->z, &IC->uz, &IC->dz) != TRUE)
                return NOTOK;
    }

    return OK;
}
예제 #3
0
int  _InitializeIsolatorContext(graphP theGraph)
{
isolatorContextP IC = &theGraph->IC;

/* Obtains the edges connecting X and Y to ancestors of the current vertex */

     if (_FindUnembeddedEdgeToAncestor(theGraph, IC->x, &IC->ux, &IC->dx) != TRUE ||
         _FindUnembeddedEdgeToAncestor(theGraph, IC->y, &IC->uy, &IC->dy) != TRUE)
         return NOTOK;

/* For Minor B, we seek the last pertinent child biconnected component, which
     is externally active, and obtain the DFS child in its root edge.
     This child is the subtree root containing vertices with connections to
     both the current vertex and an ancestor of the current vertex. */

     if (theGraph->IC.minorType & MINORTYPE_B)
     {
     int SubtreeRoot = LCGetPrev(theGraph->BicompLists,
                                 theGraph->V[IC->w].pertinentBicompList, NIL);

         IC->uz = theGraph->V[SubtreeRoot].Lowpoint;

         if (_FindUnembeddedEdgeToSubtree(theGraph, IC->v, SubtreeRoot, &IC->dw) != TRUE ||
             _FindUnembeddedEdgeToSubtree(theGraph, IC->uz, SubtreeRoot, &IC->dz) != TRUE)
             return NOTOK;
     }

/* For all other minors, we obtain  */

     else
     {
         if (_FindUnembeddedEdgeToCurVertex(theGraph, IC->w, &IC->dw) != TRUE)
             return NOTOK;

         if (theGraph->IC.minorType & MINORTYPE_E)
             if (_FindUnembeddedEdgeToAncestor(theGraph, IC->z, &IC->uz, &IC->dz) != TRUE)
                 return NOTOK;
     }

     return OK;
}