예제 #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));
        }
예제 #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;
 }
예제 #3
0
 public int GetHashCode(WeightedEdgeDestination <T> obj)
 {
     return(obj.Value.GetHashCode());
 }
예제 #4
0
 public bool Equals(WeightedEdgeDestination <T> x, WeightedEdgeDestination <T> y)
 {
     return(_comparer.Equals(x, y));
 }
예제 #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);
 }
예제 #6
0
 public EdgeDescriptor(T edge)
 {
     Edge     = edge;
     Vertices = new WeightedEdgeDestination <T> [0];
 }
예제 #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);