コード例 #1
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Retea reziduala: \n");
            sb.Append("Noduri: ");
            Noduri.ForEach(nod => sb.Append($"{nod.ToString()}, "));

            sb.AppendLine();
            sb.AppendLine("Arce: ");
            Arce.Where(a => a.GetCapacitateReziduala(this) > 0).ToList().ForEach(arc => sb.AppendLine(arc.AsString(this)));

            return(sb.ToString());
        }
コード例 #2
0
        internal double GetValoareMaxima()
        {
            double maxValue = -1;

            Noduri.ForEach(nod => {
                List <Arc> arceCareIesDinNod  = Arce.Where(arc => arc.X.Id == nod.Id).ToList();
                List <Arc> arceCareIntraInNod = Arce.Where(arc => arc.Y.Id == nod.Id).ToList();

                double value = arceCareIesDinNod.Sum(a => a.Flux) - arceCareIntraInNod.Sum(a => a.Flux);
                if (value > maxValue)
                {
                    maxValue = value;
                }
            });

            return(maxValue);
        }