Пример #1
0
 public virtual IEnumerable <Edge> Outgoing(TKey key)
 {
     if (_eOrdered)
     {
         var min    = Tuple.Create(key, Vertices[0].Key);
         var max    = Tuple.Create(key, Vertices[Vertices.Count - 1].Key);
         var minInd = Edges.BinarySearch(min, GBinarySearch.Option.EqOrGreater);
         var maxInd = Edges.BinarySearch(max, GBinarySearch.Option.EqOrLess);
         if (minInd >= 0 && maxInd >= 0)
         {
             for (int i = minInd; i <= maxInd; i++)
             {
                 yield return(Edges[i]);
             }
         }
     }
     else
     {
         foreach (var e in Edges)
         {
             if (e.Source.Key.CompareTo(key) == 0)
             {
                 yield return(e);
             }
         }
     }
 }