I generated this code to test a random undirected graph 100 times and randomly generating the nodes and weights of the graph. My problem is that when I try to store the shortest path by calling minimum distance something is going wrong and when I return the size of my list it is always 1. What is wrong?
// Random Graph Generator
for (int n = 1; n <= 101; ++n)
{
int r = 0;
nodeCount = 10; //rand() % 8128 + 64;
while (r <= nodeCount)
{
++r;
int nodeNumb = (rand() % 6); // Generates a possible node from 0 to 6 (seven possiblities)
int nodeDest = (rand() % 6); // Generates a possible node destination the same as above
int node_weight = rand() % 100 + 1; // Generate random weight of node from 1 to 101
// Create adjacency list
adjacency_list[nodeNumb].push_back(neighbourer(nodeDest, node_weight));
// For undirected graph create opposite connection back
adjacency_list[nodeDest].push_back(neighbourer(nodeNumb, node_weight));
}
vector<weight_w> min_distance; // declare vector for minimum distance
vector<vertex_v> previous; // declare vector to hold previos
int origin = 3; // origin to be inputted
int destination = 5; // destination to be inputted
list<double> pathCount;
DijkstraComputePaths(origin, adjacency_list, min_distance, previous);
pathCount.push_back(min_distance[destination]);
for (int deleteIterator = 0; deleteIterator <= 6; ++deleteIterator)
{
adjacency_list[deleteIterator].clear();
}
cout << "The List Size is: " << pathCount.size() << endl;
}