Esempio n. 1
0
 public override void ArcReverted(Arc arc)
 {
     if (Type == VertexType.A)
     {
         OutboundArcs.RemoveAll(a => a.End == TwinGraph.EndVertex);
         TwinGraph.EndVertex.InboundArcs.RemoveAll(a => a.Start == this);
         TwinGraph.Arcs.RemoveAll(a => a.Start == this && a.End == TwinGraph.EndVertex);
     }
     else
     {
         InboundArcs.RemoveAll(a => a.Start == TwinGraph.StartVertex);
         TwinGraph.StartVertex.OutboundArcs.RemoveAll(a => a.End == this);
         TwinGraph.Arcs.RemoveAll(a => a.Start == TwinGraph.StartVertex && a.End == this);
     }
     base.ArcReverted(arc);
 }
Esempio n. 2
0
        public Arc AddOutboundArc(IVertex endVertex, bool inMatching, double weight)
        {
            if (ArcHelper.DoesArcExist(this, endVertex, OutboundArcs))
            {
                throw new NoMultiedgePermitedException();
            }
            var newArc = new Arc(Graph, this, endVertex, inMatching, weight);

            OutboundArcs.AddLast(newArc);
            if (inMatching)
            {
                AddToMatching();
            }
            Log.Info("Added outbound arc " + newArc + " to vertex " + Name + " with weight " + newArc.Weight);
            endVertex.AddInboundArc(newArc, inMatching);
            return(newArc);
        }
Esempio n. 3
0
 public virtual void ArcReverted(Arc arc)
 {
     if (!IsInMatching)
     {
         AddToMatching();
     }
     if (arc.Start == this)
     {
         InboundArcs.Remove(arc);
         OutboundArcs.AddLast(arc);
     }
     if (arc.End == this)
     {
         OutboundArcs.Remove(arc);
         InboundArcs.AddLast(arc);
     }
 }