Пример #1
0
 private Edge? GetEdgeToExtend(Graph g, Edge e)
 {
     foreach (var e2 in NonplanarSubgraph.GetAllEdges())
     {
         if (!g.ContainsEdge(e2.U, e2.V) && g.ContainsEdge(e.V, e2.U) && g.ContainsEdge(e.V, e2.V))
         {
             return e2;
         }
     }
     return null;
 }
Пример #2
0
 private void ExtendNonplanarSubgraph(Graph g, Edge e)
 {
     var toExtend = GetEdgeToExtend(g, e);
     if (toExtend != null)
     {
        NonplanarSubgraph.RemoveEdge(toExtend.Value);
        NonplanarSubgraph.AddVertex(e.V);
        NonplanarSubgraph.AddUndirectedEdge(e.V, toExtend.Value.V);
        NonplanarSubgraph.AddUndirectedEdge(e.V, toExtend.Value.U);
     }
 }