Example #1
0
int  _DeleteUnmarkedVerticesAndEdges(graphP theGraph)
{
    int  v, e;

    /* All of the forward and back arcs of all of the edge records
       were removed from the adjacency lists in the planarity algorithm
       preprocessing.  We now put them back into the adjacency lists
       (and we do not mark them), so they can be properly deleted below. */

    for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++)
    {
        while (gp_IsArc(e = gp_GetVertexFwdArcList(theGraph, v)))
            _AddBackEdge(theGraph, v, gp_GetNeighbor(theGraph, e));
    }

    /* Now we delete all unmarked edges.  We don't delete vertices from the
       embedding, but the ones we should delete will become degree zero. */

    for (v = gp_GetFirstVertex(theGraph); gp_VertexInRange(theGraph, v); v++)
    {
        e = gp_GetFirstArc(theGraph, v);
        while (gp_IsArc(e))
        {
            if (gp_GetEdgeVisited(theGraph, e))
                e = gp_GetNextArc(theGraph, e);
            else e = gp_DeleteEdge(theGraph, e, 0);
        }
    }

    return OK;
}
Example #2
0
int  _DeleteUnmarkedVerticesAndEdges(graphP theGraph)
{
int  I, J, fwdArc, descendant;

     /* All of the forward and back arcs of all of the edge records
        were removed from the adjacency lists in the planarity algorithm
        preprocessing.  We now put them back into the adjacency lists
        (and we do not mark them), so they can be properly deleted below. */

     for (I = 0; I < theGraph->N; I++)
     {
         while (theGraph->V[I].fwdArcList != NIL)
         {
             fwdArc = theGraph->V[I].fwdArcList;
             descendant = theGraph->G[fwdArc].v;
             _AddBackEdge(theGraph, I, descendant);
         }
     }

     /* Now we delete all unmarked edges.  We don't delete vertices
        from the embedding, but the ones we should delete will become
        degree zero. */

     for (I = 0; I < theGraph->N; I++)
     {
          J = gp_GetFirstArc(theGraph, I);
          while (gp_IsArc(theGraph, J))
          {
                if (theGraph->G[J].visited)
                     J = gp_GetNextArc(theGraph, J);
                else J = gp_DeleteEdge(theGraph, J, 0);
          }
     }

     return OK;
}