void MatrixSparse::getFromFile(std::string filePath) { //TODO: read from the file the matrix size and values std::ifstream inputFile(filePath); //read size from the first line int size; printf("%d\n", inputFile.is_open()); inputFile >> size; if (storeType == LINE) { this->noOfLines = size; this->noOfColumns = size; //instantiate the matrix instantiateMatrix(); //read data from the file and build the matrix double value; int line, column; while (inputFile >> value >> line >> column) { // printf("l: %d c: %d v: %f\n", line, column, value); setElementAt(line, column, value); } }
void addEdge(Graph *graph, int v1, int v2) { setElementAt(graph, v1, v2); setElementAt(graph, v2, v1); }