int  _IsolateOuterplanarObstruction(graphP theGraph, int v, int R)
{
int  RetVal;

/* A subgraph homeomorphic to K_{2,3} or K_4 will be isolated by using the visited
   flags, set=keep edge/vertex and clear=omit. Here we initialize to omit all, then we
   subsequently set visited on all edges and vertices in the homeomorph. */

	 _ClearVisitedFlags(theGraph);

/* Next we determineg which of the non-outerplanarity Minors was encountered
        and the principal bicomp on which the isolator will focus attention. */

     if (_ChooseTypeOfNonOuterplanarityMinor(theGraph, v, R) != OK)
         return NOTOK;

/* Find the path connecting the pertinent vertex w with the current vertex v */

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

         if (_FindUnembeddedEdgeToSubtree(theGraph, IC->v, SubtreeRoot, &IC->dw) != TRUE)
             return NOTOK;
     }
     else
     {
     isolatorContextP IC = &theGraph->IC;

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

/* For minor E, we need to find and mark an X-Y path */

     if (theGraph->IC.minorType & MINORTYPE_E)
     {
        if (_MarkHighestXYPath(theGraph) != TRUE)
             return NOTOK;
     }

/* Call the appropriate isolator */

     if (theGraph->IC.minorType & MINORTYPE_A)
         RetVal = _IsolateOuterplanarityObstructionA(theGraph);
     else if (theGraph->IC.minorType & MINORTYPE_B)
         RetVal = _IsolateOuterplanarityObstructionB(theGraph);
     else if (theGraph->IC.minorType & MINORTYPE_E)
         RetVal = _IsolateOuterplanarityObstructionE(theGraph);
     else
    	 RetVal = NOTOK;

/* Delete the unmarked edges and vertices, and return */

     if (RetVal == OK)
         RetVal = _DeleteUnmarkedVerticesAndEdges(theGraph);

     return RetVal;
}
int  _IsolateMinorE2(graphP theGraph)
{
isolatorContextP IC = &theGraph->IC;

     _ClearVisitedFlags(theGraph);

     IC->v = IC->uz;
     IC->dw = IC->dz;
     IC->z = IC->uz = IC->dz = NIL;

     theGraph->IC.minorType ^= MINORTYPE_E;
     theGraph->IC.minorType |= (MINORTYPE_A|MINORTYPE_E2);
     return _IsolateMinorA(theGraph);
}
Exemplo n.º 3
0
int  _IsolateMinorE2(graphP theGraph)
{
    isolatorContextP IC = &theGraph->IC;

    // Note: The x-y path was already marked, due to identifying E as the type of non-planarity minor,
    // but we're reducing to Minor A, which does not include the x-y path, so the visited flags are
    // cleared as a convenient, if somewhat wasteful, way to clear the marking on the x-y path
    _ClearVisitedFlags(theGraph);

    IC->v = IC->uz;
    IC->dw = IC->dz;
    IC->z = IC->uz = IC->dz = NIL;

    theGraph->IC.minorType ^= MINORTYPE_E;
    theGraph->IC.minorType |= (MINORTYPE_A|MINORTYPE_E2);
    return _IsolateMinorA(theGraph);
}
Exemplo n.º 4
0
int  _IsolateKuratowskiSubgraph(graphP theGraph, int v, int R)
{
    int  RetVal;

    /* A subgraph homeomorphic to K_{3,3} or K_5 will be isolated by using the visited
       flags, set=keep edge/vertex and clear=omit. Here we initialize to omit all, then we
       subsequently set visited on all edges and vertices in the homeomorph. */

    _ClearVisitedFlags(theGraph);

    /* Next, we determine which of the non-planarity Minors was encountered
            and the principal bicomp on which the isolator will focus attention. */

    if (_ChooseTypeOfNonplanarityMinor(theGraph, v, R) != OK)
        return NOTOK;

    if (_InitializeIsolatorContext(theGraph) != OK)
        return NOTOK;

    /* Call the appropriate isolator */

    if (theGraph->IC.minorType & MINORTYPE_A)
        RetVal = _IsolateMinorA(theGraph);
    else if (theGraph->IC.minorType & MINORTYPE_B)
        RetVal = _IsolateMinorB(theGraph);
    else if (theGraph->IC.minorType & MINORTYPE_C)
        RetVal = _IsolateMinorC(theGraph);
    else if (theGraph->IC.minorType & MINORTYPE_D)
        RetVal = _IsolateMinorD(theGraph);
    else if (theGraph->IC.minorType & MINORTYPE_E)
        RetVal = _IsolateMinorE(theGraph);
    else
        RetVal = NOTOK;

    /* Delete the unmarked edges and vertices, and return */

    if (RetVal == OK)
        RetVal = _DeleteUnmarkedVerticesAndEdges(theGraph);

    return RetVal;
}