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)); }
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; }
public int GetHashCode(WeightedEdgeDestination <T> obj) { return(obj.Value.GetHashCode()); }
public bool Equals(WeightedEdgeDestination <T> x, WeightedEdgeDestination <T> y) { return(_comparer.Equals(x, y)); }
internal static void AssertVertex <T>(this WeightedEdgeDestination <T> actual, T expectedValue, int expectedWeight) { Assert.Equal(expectedValue, actual.Value); Assert.Equal(expectedWeight, actual.Weight); }
public EdgeDescriptor(T edge) { Edge = edge; Vertices = new WeightedEdgeDestination <T> [0]; }
public static StepMetadata <T> ForSpanningTree(T source, WeightedEdgeDestination <T> destination, IReadOnlyDictionary <T, DistanceInfo <T> > distances) => new StepMetadata <T>(source, destination, distances, destination.Weight);