Exemple #1
0
 public void RemoveArc(TwinVertex tvFrom, TwinVertex tvTo, bool inMatching)
 {
     Log.Info("Removing arc " + tvFrom + " -> " + tvTo + " M?: " + inMatching + " from TwinGraph");
     if (inMatching)
     {
         if (ArcHelper.DeleteArc(tvFrom.A, tvTo.B, Arcs))
         {
             tvFrom.A.RemoveArc(tvTo.B);
         }
         else
         {
             throw new NoArcException();
         }
     }
     else
     {
         if (ArcHelper.DeleteArc(tvFrom.B, tvTo.A, Arcs))
         {
             tvFrom.B.RemoveArc(tvTo.A);
         }
         else
         {
             throw new NoArcException();
         }
     }
 }
Exemple #2
0
 public void EndVertexRemoved(IVertex endVertex)
 {
     if (!ArcHelper.DoesArcExist(this, endVertex, OutboundArcs))
     {
         throw new NoArcException();
     }
     ArcHelper.DeleteArc(this, endVertex, OutboundArcs);
 }
Exemple #3
0
 public void RemoveInboundArc(IVertex startVertex)
 {
     Log.Info("Removing inbound arc from vertex " + Name);
     if (!ArcHelper.DoesArcExist(startVertex, this, InboundArcs))
     {
         throw new NoArcException();
     }
     ArcHelper.DeleteArc(startVertex, this, InboundArcs);
 }
Exemple #4
0
 public void RemoveArc(IVertex vertex)
 {
     Log.Info("Removing outbound arc from vertex " + Name);
     if (!ArcHelper.DoesArcExist(this, vertex, OutboundArcs))
     {
         throw new NoArcException();
     }
     vertex.RemoveInboundArc(this);
     ArcHelper.DeleteArc(this, vertex, OutboundArcs);
 }
Exemple #5
0
 public void RemoveArc(IVertex v1, IVertex v2)
 {
     if (ArcHelper.DeleteArc(v1, v2, Arcs))
     {
         Log.Info("Removed arc " + v1.Name + " -> " + v2.Name + " from graph");
         v1.RemoveArc(v2);
     }
     else
     {
         throw new NoArcException();
     }
 }
Exemple #6
0
        public Arc AddArc(TwinVertex startVertex, TwinVertex endVertex, bool inMatching)
        {
            ABVertex start;
            ABVertex end;

            if (inMatching)
            {
                start = startVertex.A;
                end   = endVertex.B;
                bool arcExisted = ArcHelper.DeleteArc(StartVertex, startVertex.B, Arcs);
                if (arcExisted)
                {
                    StartVertex.RemoveArc(startVertex.B);
                }
                arcExisted = ArcHelper.DeleteArc(StartVertex, endVertex.B, Arcs);
                if (arcExisted)
                {
                    StartVertex.RemoveArc(endVertex.B);
                }
                arcExisted = ArcHelper.DeleteArc(startVertex.A, EndVertex, Arcs);
                if (arcExisted)
                {
                    startVertex.A.RemoveArc(EndVertex);
                }
                arcExisted = ArcHelper.DeleteArc(endVertex.A, EndVertex, Arcs);
                if (arcExisted)
                {
                    endVertex.A.RemoveArc(EndVertex);
                }
            }
            else
            {
                start = startVertex.B;
                end   = endVertex.A;
            }
            return(AddArc(start, end, inMatching));
        }