0

Hi I have a little problem. I am having a project and i need to implement Dijkstra for a graph.So far it was ok but i have that problem when run it in g++

The code is where i think i have the error is here i think:

```
if(!graph_list.at(start_Node->id)->path_list.empty())
{
vector<Edge>::iterator it=graph_list.at(start_Node->id)->path_list.begin();
for(;it!=graph_list.at(start_Node->id)->path_list.end();it++)
{
if(graph_list.at(it->destination_Node->id)->colour==WHITE)
{
next_Node=it->destination_Node;
next_Node->cost+=it->distance;
graph_list.at(next_Node->id)->colour=GREY;
pri_queue.push(next_Node);
}
//relax the cost
if(graph_list.at(it->destination_Node->id)->cost>
graph_list.at(start_Node->id)->cost+it->distance)
{
graph_list.at(it->destination_Node->id)->cost=
graph_list.at(start_Node->id)->cost+it->distance;
graph_list.at(it->destination_Node->id)->previous=start_Node;
}
}
```

And the error is :

```
/share/gcc/el6-x86_64/gcc-4.8.1/include/c++/4.8.1/bits/stl_heap.h:218:
error: elements in iterator range [__first, __last - 1) do not form a
heap with respect to the predicate __comp.
Objects involved in the operation:
iterator "__first" @ 0x0x7fff29ee4680 {
type = N11__gnu_debug14_Safe_iteratorIN9__gnu_cxx17__normal_iteratorIPPN13Datastructure4NodeENSt9__cxx19986vectorIS5_SaIS5_EEEEENSt7__debug6vectorIS5_S9_EEEE (mutable iterator);
state = dereferenceable (start-of-sequence);
references sequence with type `NSt7__debug6vectorIPN13Datastructure4NodeESaIS3_EEE' @ 0x0x7fff29ee4680
}
iterator "__last - 1" @ 0x0x7fff29ee4340 {
type = N11__gnu_debug14_Safe_iteratorIN9__gnu_cxx17__normal_iteratorIPPN13Datastructure4NodeENSt9__cxx19986vectorIS5_SaIS5_EEEEENSt7__debug6vectorIS5_S9_EEEE (mutable iterator);
state = dereferenceable;
references sequence with type `NSt7__debug6vectorIPN13Datastructure4NodeESaIS3_EEE' @ 0x0x7fff29ee4340
```

Can anybody help me where is the problem ?

Thank you in advance

*Edited 2 Years Ago by spawn2004*