Esempio n. 1
0
        public static StepMetadata <T> ForPath(T source, WeightedEdgeDestination <T> destination,
                                               IReadOnlyDictionary <T, DistanceInfo <T> > distances)
        {
            var distance = distances[source].Distance + destination.Weight;

            return(new StepMetadata <T>(source, destination, distances, distance));
        }
Esempio n. 2
0
 private StepMetadata(T source, WeightedEdgeDestination <T> destination,
                      IReadOnlyDictionary <T, DistanceInfo <T> > distances, int distance)
 {
     _source             = source;
     _destination        = destination;
     SourceDistance      = distances[source];
     DestinationDistance = distances[destination];
     Distance            = distance;
     Edges = SourceDistance.NumberOfEdges + 1;
 }
Esempio n. 3
0
 public int GetHashCode(WeightedEdgeDestination <T> obj)
 {
     return(obj.Value.GetHashCode());
 }
Esempio n. 4
0
 public bool Equals(WeightedEdgeDestination <T> x, WeightedEdgeDestination <T> y)
 {
     return(_comparer.Equals(x, y));
 }
Esempio n. 5
0
 internal static void AssertVertex <T>(this WeightedEdgeDestination <T> actual, T expectedValue, int expectedWeight)
 {
     Assert.Equal(expectedValue, actual.Value);
     Assert.Equal(expectedWeight, actual.Weight);
 }
Esempio n. 6
0
 public EdgeDescriptor(T edge)
 {
     Edge     = edge;
     Vertices = new WeightedEdgeDestination <T> [0];
 }
Esempio n. 7
0
 public static StepMetadata <T> ForSpanningTree(T source, WeightedEdgeDestination <T> destination,
                                                IReadOnlyDictionary <T, DistanceInfo <T> > distances) => new StepMetadata <T>(source, destination, distances, destination.Weight);