Changeset 8539
- Timestamp:
- 08/29/12 18:18:53 (12 years ago)
- Location:
- branches/RoutePlanning/HeuristicLab.Algorithms.GraphRouting/3.3
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RoutePlanning/HeuristicLab.Algorithms.GraphRouting/3.3/HeuristicLab.Algorithms.GraphRouting.csproj
r8527 r8539 61 61 <Compile Include="AStarAlgorithmV4.cs" /> 62 62 <Compile Include="AStarAlgorithmV5.cs" /> 63 <Compile Include="DijkstraNoDecAlgorithm.cs" /> 63 64 <Compile Include="DijkstraAlgorithmV2.cs" /> 64 65 <Compile Include="GraphRoutingAlgorithm.cs" /> -
branches/RoutePlanning/HeuristicLab.Algorithms.GraphRouting/3.3/PriorityQueues/BinHeap.cs
r8527 r8539 92 92 while ((left < size - 1 && data[idx].Key.CompareTo(data[left].Key) != -1) || 93 93 (right < size - 1 && data[idx].Key.CompareTo(data[right].Key) != -1)) { 94 if ((right >= size - 1) || (data[ idx].Key.CompareTo(data[right].Key) == -1)) {94 if ((right >= size - 1) || (data[left].Key.CompareTo(data[right].Key) == -1)) { 95 95 Swap(left, idx); 96 96 idx = left; -
branches/RoutePlanning/HeuristicLab.Algorithms.GraphRouting/3.3/PriorityQueues/BinaryHeap.cs
r8527 r8539 1 1 2 2 using System; 3 using System.Collections.Generic; 4 using HeuristicLab.Algorithms.GraphRouting.Interfaces; 3 5 namespace HeuristicLab.Algorithms.GraphRouting.PriorityQueues { 4 6 // implementation based on C++ version from Peter Sanders 5 7 // http://www.mpi-inf.mpg.de/~sanders/programs/spq/ 6 public sealed class BinaryHeap<K, V> where K : IComparable {8 public sealed class BinaryHeap<K, V> : IHeap<K, V> where K : IComparable { 7 9 private class KNElement { 8 10 public K Key { get; set; } … … 31 33 public int Size { 32 34 get { return size; } 35 } 36 37 public KeyValuePair<K, V> PeekMin() { 38 if (size == 0) { 39 throw new InvalidOperationException("Heap is empty"); 40 } 41 return new KeyValuePair<K, V>(data[1].Key, data[1].Value); 33 42 } 34 43
Note: See TracChangeset
for help on using the changeset viewer.