Пример #1
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);
        }
Пример #2
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);
     }
 }