Question: can you help me fix this syntax error, I don't understand what I am doing wrong dijkstra.h: 2 4 7 : 3 5 : error:
can you help me fix this syntax error, I don't understand what I am doing wrong
dijkstra.h::: error: const class graph has no member named getNeighbor
for const auto &edge : ggetNeighboruvertexNum
void DijkstraShortestPathconst graph &g int start
int numVertices ggetNumVer;
minHeap minHeapnumVertices; assuming minHeap can be constructed with the number of vertices
int locator new intnumVertices; Dynamic array for locator
Initialize all vertices
for int i ; i numVertices; i
vertex ver;
ver.vertexNum i;
ver.curDist ;
ver.predecessor ;
minHeap.insertver;
locatori i; Locator initialization
Update the start vertex in the heap
vertex startVertex minHeap.getElemlocatorstart;
startVertex.curDist ;
minHeap.updateElemlocatorstart startVertex;
Dijkstra's algorithm main loop
while minHeap.isEmpty
vertex u minHeap.getMin;
int uIndex locatoruvertexNum;
for const auto &edge : ggetNeighboruvertexNum
int v edge.first;
int weight edge.second;
int vIndex locatorv;
if ucurDist weight minHeap.getElemvIndexcurDist
vertex vVertex minHeap.getElemvIndex;
vVertex.curDist ucurDist weight;
vVertex.predecessor uvertexNum;
minHeap.updateElemvIndex vVertex;
Clean up the dynamic array
delete locator;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
