Skip to content
Snippets Groups Projects
Commit 3544acf4 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

graph algo: fix Dijkstra's algo

parent bf6d1072
No related branches found
No related tags found
1 merge request!186Merge jt
Pipeline #140394 passed with warnings
......@@ -292,10 +292,12 @@ bool Dijkstra::relaxation(FEdges successor_edges,
// If not or the distance can be improve do relaxation
if (search_d == data.g.end() || search_d->second > gscore) {
// Search if the node s is in OPEN
auto search_q = data.queue.find(ext::make_pair(search_d->second, s));
if (search_q != data.queue.end()) {
// Erase node from priority queue
data.queue.erase(search_q);
if (search_d != data.g.end()) {
auto search_q = data.queue.find(ext::make_pair(search_d->second, s));
if (search_q != data.queue.end()) {
// Erase node from priority queue
data.queue.erase(search_q);
}
}
 
data.g[s] = gscore;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment