- Timestamp:
- 08/20/12 17:32:19 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/RoutePlanning/HeuristicLab.Algorithms.GraphRouting/3.3/DijkstraAlgorithmV2.cs
r8481 r8509 53 53 54 54 #endregion 55 56 public long GetNodeIdWithRank(long sourceNodeId, int rank) { 57 visitedNodes = new HashSet<long>(); // visited 58 unvisitedNodes = new HashSet<long>(); // unvisited 59 distances = new Dictionary<long, float>(); 60 predecessors = new Dictionary<long, long>(); 61 int currentRank = 0; 62 63 64 long currentNode = sourceNodeId; 65 distances.Add(currentNode, 0); 66 unvisitedNodes.Add(currentNode); 67 68 while (unvisitedNodes.Count > 0) { 69 currentNode = GetMinimumDistance(unvisitedNodes); 70 visitedNodes.Add(currentNode); 71 unvisitedNodes.Remove(currentNode); 72 currentRank++; 73 if (currentRank == rank) { 74 break; 75 } 76 FindMinimalWeight(currentNode); 77 } 78 return currentNode; 79 } 55 80 56 81 private long GetMinimumDistance(HashSet<long> nodeIds) {
Note: See TracChangeset
for help on using the changeset viewer.