If you look at the code below, I am trying to create a priority_queue
, I have named it DijkstraPriorityQueue
, that has a custom comparator which also uses the private vector distTo
.
You can see that I have some dots .......
as everything I tried have failed.
What is the cleanest solution (or possible solutions) to make this work as intended in this specific case ?
Dijkstra.h
class Dijkstra
{
public:
Dijkstra(Graph G, int s); // Create
~Dijkstra(); // Destroy
private:
bool compare(int u, int v)
{
return distTo[u] < distTo[v];
}
typedef priority_queue<int, vector<int>, .........> DijkstraPriorityQueue;
vector<float> distTo; // distTo[u] is the distance of the shortest s->u path
DijkstraPriorityQueue PQ; // Min-Priority Queue, implemented for Dijkstra
};
Dijkstra.cpp
Dijkstra::Dijkstra(Graph G, int s)
{
PQ = DijkstraPriorityQueue(...........);
}
Aucun commentaire:
Enregistrer un commentaire