I think the problem si simply this:
In line 16 you create a Graph object :
Graph graph; Then in lines 23,28,33,41,46,51,56 another local object with the same name .
Then in line 72 you use the original object:
graph.loadPoints(plName);//this is graph at line 16
You can fix simply this way(I modified only lines mentioned ):
#include <cstdlib>
#include "graph.h"
#include "utils.h"
int main(int argc, char **argv)
{
if (argc != 4)
{
std::cout << "Usage: exe filename algorithm data_structure\n";
return EXIT_SUCCESS;
}
int iType = toInt(argv[2]);
int sType = toInt(argv[3]);
Graph graph;
if (iType == 1)
{
if (sType == 0) {
Heap queue(1);
Prim prim(queue);
graph = Graph(prim); // Heap
}
else if (sType == 1) {
UnorderedArray queue;
Prim prim(queue);
graph = Graph(prim); // Unordered
}
else {
StdPQueue queue;
Prim prim(queue);
graph = Graph(prim); // Std;
}
}
else
{
if (sType == 0) {
HeapSort sort;
Kruskal krus(sort);
graph = Graph(krus); // heapsort;
}
else if (sType == 1) {
MergeSort sort;
Kruskal krus(sort);
graph = Graph(krus); // mergesort;
}
else if (sType == 2) {
BubbleSort sort;
Kruskal krus(sort);
graph = Graph(krus); // bubblesort;
}
else {
StdSort sort;
Kruskal krus(sort);
graph = Graph(krus); // stdsort;
}
}
// This would be a more appropriate use of the tokenizer, as splitting streams
// based on tokens to get part of a string can be tricky if multiple different
// character tokens are required (stream functions only accept a single character
// token)
std::string plName = argv[1];
std::vector<std::string> t = tokenize(plName, "-.");
int size = toInt(t.at(t.size() - 2));
std::stringstream mss;
mss << "mst-" << size << ".svg";
std::string mstName = mss.str();
graph.loadPoints(plName);
graph.calculateMST();
graph.saveMST(mstName);
return EXIT_SUCCESS;
}