Dijkstra Problem wrong answer

Please tell where i’m wrong. Here is my code.

Why are complexing your code so much? No heaps reqd.
Just use the dijkstra on the graph, either by lists or simply by adjacency matrix.

Here is my code using matrix method and now it is giving me run error. I don’t know why.
I’ve just mapped 1-N graph vertex in 0 - (N-1) vertex and also used long to handle if there are larger values.

Your findMinWeightVertex function is slightly wrong. Also, mark visited of MinVertex true and not for every i in Dijkstra function

int findMinWeightVertex(int *distance,bool *visited,int V)
{
int minVertex = -1;
for(int i=0;i<V;i++)
{
if(visited[i]==false && (minVertex==-1 || distance[minVertex]>distance[i]))
{
minVertex = i;
}
}
return minVertex;
}

//find minWeightVertex for every unvisited
int minWeightVertex = findMinWeightVertex(distance,visited,V);
visited[minWeightVertex]=true;

I’ve corrected my code as you told me still giving me wrong-answer.
Here is my udated code.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Still Not working. Please resolve it

Your code seems absolutely fine. There is no logical error

Then why is it giving me wrong answer ???

Can you message me in my inbox?
I’m unable to find this link