Exemple #1
0
 private void Visit(EdgeWeightedGraph graph, int vertex, ISet <int> excludes)
 {
     Marked[vertex] = true;
     foreach (var edge in graph.Edges[vertex].Where(edge => !excludes.Contains(edge.Id)))
     {
         var other = edge.OtherVertex(vertex);
         if (Marked[other] || edge.Weight >= DistTo[other])
         {
             continue;
         }
         EdgeTo[other] = edge;
         DistTo[other] = edge.Weight;
         if (_priorityQueue.Contains(other))
         {
             _priorityQueue.Change(other, DistTo[other]);
         }
         else
         {
             _priorityQueue.Insert(other, DistTo[other]);
         }
     }
 }