diff --git a/serial/Makefile b/serial/Makefile index 9c4e0e6..b321b1d 100644 --- a/serial/Makefile +++ b/serial/Makefile @@ -7,8 +7,8 @@ CC = gcc RM = rm -f CFLAGS_DEBUG=-O0 -ggdb3 -Wall -I. CFLAGS=-O3 -Wall -I. -OBJ=serial_gs_pagerank.o serial_gs_pagerank_functions.o coo_sparse_matrix.o lil_sparse_matrix.o -DEPS=serial_gs_pagerank_functions.h coo_sparse_matrix.h lil_sparse_matrix.h +OBJ=serial_gs_pagerank.o serial_gs_pagerank_functions.o coo_sparse_matrix.o csr_sparse_matrix.o +DEPS=serial_gs_pagerank_functions.h coo_sparse_matrix.h csr_sparse_matrix.h # ========================================== # TARGETS diff --git a/serial/coo_sparse_matrix.c b/serial/coo_sparse_matrix.c index 42fc7f1..93d0ac9 100644 --- a/serial/coo_sparse_matrix.c +++ b/serial/coo_sparse_matrix.c @@ -3,16 +3,25 @@ CooSparseMatrix initCooSparseMatrix() { CooSparseMatrix sparseMatrix; sparseMatrix.size = 0; + sparseMatrix.numberOfNonZeroElements = 0; sparseMatrix.elements = NULL; return sparseMatrix; } -void allocMemoryForElements (CooSparseMatrix *sparseMatrix, int elements) { +void allocMemoryForCoo(CooSparseMatrix *sparseMatrix, int numberOfElements) { sparseMatrix->elements = (CooSparseMatrixElement **) malloc( - elements * sizeof(CooSparseMatrixElement *)); + numberOfElements * sizeof(CooSparseMatrixElement *)); + sparseMatrix->size = numberOfElements; } void addElement(CooSparseMatrix *sparseMatrix, double value, int row, int column) { + if (sparseMatrix->numberOfNonZeroElements == sparseMatrix->size) { + printf("%d == %d |||| %d, %d\n", sparseMatrix->numberOfNonZeroElements, + sparseMatrix->size, row, column); + printf("Number of non zero elements exceeded size of matrix!\n"); + exit(EXIT_FAILURE); + } + // Creates the new element CooSparseMatrixElement *newElement = (CooSparseMatrixElement *) malloc( sizeof(CooSparseMatrixElement)); @@ -20,58 +29,57 @@ void addElement(CooSparseMatrix *sparseMatrix, double value, int row, int column newElement->rowIndex = row; newElement->columnIndex = column; - sparseMatrix->elements[sparseMatrix->size] = newElement; - sparseMatrix->size = sparseMatrix->size + 1; + sparseMatrix->elements[sparseMatrix->numberOfNonZeroElements] = newElement; + sparseMatrix->numberOfNonZeroElements = sparseMatrix->numberOfNonZeroElements + 1; } -void zeroOutRow(CooSparseMatrix *sparseMatrix, int row) { - for (int i=0; isize; ++i) { - CooSparseMatrixElement *element = sparseMatrix->elements[i]; - if (element->rowIndex == row) { - element->value = 0; - } - } -} -void zeroOutColumn(CooSparseMatrix *sparseMatrix, int column) { - for (int i=0; isize; ++i) { +void transposeSparseMatrix(CooSparseMatrix *sparseMatrix) { + for (int i=0; inumberOfNonZeroElements; ++i) { CooSparseMatrixElement *element = sparseMatrix->elements[i]; - if (element->columnIndex == column) { - element->value = 0; - } + int tempRow = element->rowIndex; + element->rowIndex = element->columnIndex; + element->columnIndex = tempRow; } } -int *getRowIndexes(CooSparseMatrix sparseMatrix, int row, int *rowSize) { - *rowSize = 0; - for (int i=0; irowIndex == row) { - ++(*rowSize); - } +void transformToCSR(CooSparseMatrix initialSparseMatrix, + CsrSparseMatrix *transformedSparseMatrix) { + // Taken from here: https://github.com/scipy/scipy/blob/3b36a57/scipy/sparse/sparsetools/coo.h#L34 + if (initialSparseMatrix.numberOfNonZeroElements > transformedSparseMatrix->size) { + printf("Transformed CSR matrix does not have enough space!\n"); + exit(EXIT_FAILURE); } - if (!(*rowSize)) { - return NULL; + for (int i=0; irowIndex; + transformedSparseMatrix->rowCumulativeIndexes[rowIndex] = + transformedSparseMatrix->rowCumulativeIndexes[rowIndex] + 1; } - int *indexes = (int *) malloc((*rowSize) * sizeof(int)); - int rowElementIndex = 0; - for (int i=0; irowIndex == row) { - indexes[rowElementIndex] = i; - ++rowElementIndex; - } + // Cumulative sums the non zero elements per row + for (int i=0, sum=0; isize+1; ++i){ + int temp = transformedSparseMatrix->rowCumulativeIndexes[i]; + transformedSparseMatrix->rowCumulativeIndexes[i] = sum; + sum += temp; } - return indexes; -} + for (int i=0; irowIndex; + int destinationIndex = transformedSparseMatrix->rowCumulativeIndexes[row]; -void transposeSparseMatrix(CooSparseMatrix *sparseMatrix) { - for (int i=0; isize; ++i) { - CooSparseMatrixElement *element = sparseMatrix->elements[i]; - int tempRow = element->rowIndex; - element->rowIndex = element->columnIndex; - element->columnIndex = tempRow; + transformedSparseMatrix->columnIndexes[destinationIndex] = initialSparseMatrix.elements[i]->columnIndex; + transformedSparseMatrix->values[destinationIndex] = initialSparseMatrix.elements[i]->value; + + transformedSparseMatrix->rowCumulativeIndexes[row]++; } + + for (int i=0, last=0; i<=transformedSparseMatrix->size; i++){ + int temp = transformedSparseMatrix->rowCumulativeIndexes[i]; + transformedSparseMatrix->rowCumulativeIndexes[i] = last; + last = temp; + } + + transformedSparseMatrix->numberOfNonZeroElements = initialSparseMatrix.numberOfNonZeroElements; } void cooSparseMatrixVectorMultiplication(CooSparseMatrix sparseMatrix, @@ -82,7 +90,7 @@ void cooSparseMatrixVectorMultiplication(CooSparseMatrix sparseMatrix, } CooSparseMatrixElement *element; - for (int i=0; irowIndex, column = element->columnIndex; @@ -97,19 +105,19 @@ void cooSparseMatrixVectorMultiplication(CooSparseMatrix sparseMatrix, } void destroyCooSparseMatrix(CooSparseMatrix *sparseMatrix) { - for (int i=0; isize; ++i) { + for (int i=0; inumberOfNonZeroElements; ++i) { free(sparseMatrix->elements[i]); } free(sparseMatrix->elements); } void printCooSparseMatrix(CooSparseMatrix sparseMatrix) { - if (sparseMatrix.size == 0) { + if (sparseMatrix.numberOfNonZeroElements == 0) { return; } CooSparseMatrixElement *element; - for (int i=0; irowIndex, element->columnIndex, element->value); diff --git a/serial/coo_sparse_matrix.h b/serial/coo_sparse_matrix.h index 66f538b..dd4c31d 100644 --- a/serial/coo_sparse_matrix.h +++ b/serial/coo_sparse_matrix.h @@ -6,25 +6,27 @@ #include #include +#include "csr_sparse_matrix.h" + typedef struct cooSparseMatrixElement { double value; int rowIndex, columnIndex; } CooSparseMatrixElement; typedef struct cooSparseMatrix { - int size; + int size, numberOfNonZeroElements; CooSparseMatrixElement **elements; } CooSparseMatrix; CooSparseMatrix initCooSparseMatrix(); -void allocMemoryForElements (CooSparseMatrix *sparseMatrix, int elements); -void addElement(CooSparseMatrix *sparseMatrix, double value, int row, int column); -void zeroOutRow(CooSparseMatrix *sparseMatrix, int row); -void zeroOutColumn(CooSparseMatrix *sparseMatrix, int column); -int *getRowIndexes(CooSparseMatrix sparseMatrix, int row, int *rowSize); +void allocMemoryForCoo(CooSparseMatrix *sparseMatrix, int numberOfElements); +void addElement(CooSparseMatrix *sparseMatrix, double value, int row, + int column); void transposeSparseMatrix(CooSparseMatrix *sparseMatrix); -void cooSparseMatrixVectorMultiplication(CooSparseMatrix sparseMatrix, double *vector, - double **product, int vectorSize); +void transformToCSR(CooSparseMatrix initialSparseMatrix, + CsrSparseMatrix *transformedSparseMatrix); +void cooSparseMatrixVectorMultiplication(CooSparseMatrix sparseMatrix, + double *vector, double **product, int vectorSize); void destroyCooSparseMatrix(CooSparseMatrix *sparseMatrix); void printCooSparseMatrix(CooSparseMatrix sparseMatrix); diff --git a/serial/csr_sparse_matrix.c b/serial/csr_sparse_matrix.c new file mode 100644 index 0000000..bdf8413 --- /dev/null +++ b/serial/csr_sparse_matrix.c @@ -0,0 +1,93 @@ +#include "csr_sparse_matrix.h" + +CsrSparseMatrix initCsrSparseMatrix() { + CsrSparseMatrix sparseMatrix; + sparseMatrix.size = 0; + sparseMatrix.numberOfNonZeroElements = 0; + + sparseMatrix.values = NULL; + sparseMatrix.columnIndexes = NULL; + sparseMatrix.rowCumulativeIndexes = NULL; + return sparseMatrix; +} + +void allocMemoryForCsr(CsrSparseMatrix *sparseMatrix, int numberOfElements) { + sparseMatrix->values = (double *) malloc(numberOfElements * sizeof(double)); + sparseMatrix->columnIndexes = (int *) malloc( + numberOfElements * sizeof(int)); + sparseMatrix->rowCumulativeIndexes = (int *) malloc( + (numberOfElements + 1) * sizeof(int)); + + for (int i=0; irowCumulativeIndexes[i] = 0; + } + sparseMatrix->size = numberOfElements; +} + +// Row indexes start from 0! +void zeroOutRow(CsrSparseMatrix *sparseMatrix, int row) { + int startIndex = sparseMatrix->rowCumulativeIndexes[row], + endIndex = sparseMatrix->rowCumulativeIndexes[row+1]; + for (int i=startIndex; ivalues[i] = 0; + } +} + +void zeroOutColumn(CsrSparseMatrix *sparseMatrix, int column) { + for (int i=0; inumberOfNonZeroElements; ++i){ + if(sparseMatrix->columnIndexes[i] == column){ + // Zeros out this element + sparseMatrix->values[i] = 0; + } + } +} + +void csrSparseMatrixVectorMultiplication(CsrSparseMatrix sparseMatrix, + double *vector, double **product, int vectorSize) { + // Initializes the elements of the product vector to zero + for (int i=0; ivalues); + free(sparseMatrix->rowCumulativeIndexes); + free(sparseMatrix->columnIndexes); +} + +void printCsrSparseMatrix(CsrSparseMatrix sparseMatrix) { + if (sparseMatrix.size == 0) { + return; + } + + for (int i=0; i +#include +#include +#include + +typedef struct csrSparseMatrix { + int size, numberOfNonZeroElements; + int *rowCumulativeIndexes, *columnIndexes; + double *values; +} CsrSparseMatrix; + +CsrSparseMatrix initCsrSparseMatrix(); +void allocMemoryForCsr(CsrSparseMatrix *sparseMatrix, int numberOfElements); +void zeroOutRow(CsrSparseMatrix *sparseMatrix, int row); +void zeroOutColumn(CsrSparseMatrix *sparseMatrix, int column); +void csrSparseMatrixVectorMultiplication(CsrSparseMatrix sparseMatrix, + double *vector, double **product, int vectorSize); +void destroyCsrSparseMatrix(CsrSparseMatrix *sparseMatrix); +void printCsrSparseMatrix(CsrSparseMatrix sparseMatrix); + +#endif // CSR_SPARSE_MATRIX_H \ No newline at end of file diff --git a/serial/lil_sparse_matrix.c b/serial/lil_sparse_matrix.c deleted file mode 100644 index 61777ea..0000000 --- a/serial/lil_sparse_matrix.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "lil_sparse_matrix.h" - -LilSparseMatrix createLilSparseMatrix() { - LilSparseMatrix sparseMatrix; - sparseMatrix.elements = 0; - sparseMatrix.firstElement = NULL; - sparseMatrix.lastElement = NULL; - return sparseMatrix; -} - -void apendElement(LilSparseMatrix *sparseMatrix, double value, int row, int column) { - // Creates the new element - LilSparseMatrixElement *newElement = (LilSparseMatrixElement *) malloc(sizeof(LilSparseMatrixElement)); - newElement->value = value; - newElement->rowIndex = row; - newElement->columnIndex = column; - newElement->nextElement = NULL; - - if (sparseMatrix->firstElement == NULL) { - // Sparse matrix is empty, this is the first element - sparseMatrix->firstElement = newElement; - sparseMatrix->lastElement = newElement; - } else { - //Gets last element of the matrix - LilSparseMatrixElement *lastElement = sparseMatrix->lastElement; - - lastElement->nextElement = newElement; - sparseMatrix->lastElement = newElement; - } - - sparseMatrix->elements = sparseMatrix->elements + 1; -} - -void lilSparseMatrixVectorMultiplication(LilSparseMatrix sparseMatrix, - double *vector, double **product, int vectorSize) { - // Initializes the elements of the product vector to zero - for (int i=0; irowIndex, column = element->columnIndex; - - if (row >= vectorSize) { - printf("Error at sparseMatrixVectorMultiplication. Matrix has more rows than vector!\n"); - printf("row = %d\n", row); - exit(EXIT_FAILURE); - } - - (*product)[row] = (*product)[row] + element->value * vector[column]; - element = element->nextElement; - } -} - -void destroyLilSparseMatrix(LilSparseMatrix *sparseMatrix) { - LilSparseMatrixElement *currentElement = sparseMatrix->firstElement; - while (currentElement != NULL) { - LilSparseMatrixElement *toDelete = currentElement; - currentElement = currentElement->nextElement; - free(toDelete); - } -} - -void printLilSparseMatrix(LilSparseMatrix sparseMatrix) { - if (sparseMatrix.elements == 0) { - return; - } - - LilSparseMatrixElement *currentElement = sparseMatrix.firstElement; - for (int i=0; irowIndex, - currentElement->columnIndex, currentElement->value); - currentElement = currentElement->nextElement; - } -} \ No newline at end of file diff --git a/serial/lil_sparse_matrix.h b/serial/lil_sparse_matrix.h deleted file mode 100644 index 599cdae..0000000 --- a/serial/lil_sparse_matrix.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef LIL_SPARSE_MATRIX_H /* Include guard */ -#define LIL_SPARSE_MATRIX_H - -#include -#include -#include -#include - -typedef struct lilSparseMatrixElement { - double value; - int rowIndex, columnIndex; - struct lilSparseMatrixElement *nextElement; -} LilSparseMatrixElement; - -typedef struct lilSparseMatrix { - int elements; - LilSparseMatrixElement *firstElement; - LilSparseMatrixElement *lastElement; -} LilSparseMatrix; - -LilSparseMatrix createLilSparseMatrix(); -void apendElement(LilSparseMatrix *sparseMatrix, double value, int row, - int column); -void lilSparseMatrixVectorMultiplication(LilSparseMatrix sparseMatrix, - double *vector, double **product, int vectorSize); -void destroyLilSparseMatrix(LilSparseMatrix *sparseMatrix); -void printLilSparseMatrix(LilSparseMatrix sparseMatrix); - -#endif // LIL_SPARSE_MATRIX_H \ No newline at end of file diff --git a/serial/serial_gs_pagerank.c b/serial/serial_gs_pagerank.c index 9a4cf6f..dd9a6e7 100644 --- a/serial/serial_gs_pagerank.c +++ b/serial/serial_gs_pagerank.c @@ -7,7 +7,7 @@ struct timeval startwtime, endwtime; double seq_time; int main(int argc, char **argv) { - CooSparseMatrix transitionMatrix = initCooSparseMatrix(); + CsrSparseMatrix transitionMatrix = initCsrSparseMatrix(); double *pagerankVector; bool convergenceStatus; Parameters parameters; @@ -40,5 +40,5 @@ int main(int argc, char **argv) { seq_time); free(pagerankVector); - destroyCooSparseMatrix(&transitionMatrix); + destroyCsrSparseMatrix(&transitionMatrix); } diff --git a/serial/serial_gs_pagerank_functions.c b/serial/serial_gs_pagerank_functions.c index b8b9e9e..98fd38c 100644 --- a/serial/serial_gs_pagerank_functions.c +++ b/serial/serial_gs_pagerank_functions.c @@ -16,17 +16,17 @@ char *DEFAULT_OUTPUT_FILENAME = "pagerank_output"; const int FILE_READ_BUFFER_SIZE = 4096; const int CONVERGENCE_CHECK_ITERATION_PERIOD = 3; -const int SPARSITY_INCREASE_ITERATION_PERIOD = 9; +const int SPARSITY_INCREASE_ITERATION_PERIOD = 3; /* ===== FUNCTIONS ===== */ -int pagerank(CooSparseMatrix *transitionMatrix, double **pagerankVector, +int pagerank(CsrSparseMatrix *transitionMatrix, double **pagerankVector, bool *convergenceStatus, Parameters parameters) { // Variables declaration int iterations = 0, numberOfPages = parameters.numberOfPages; double delta, *pagerankDifference, *previousPagerankVector, *convergedPagerankVector, *linksFromConvergedPagesPagerankVector; - LilSparseMatrix linksFromConvergedPages = createLilSparseMatrix(); + CooSparseMatrix linksFromConvergedPages = initCooSparseMatrix(); bool *convergenceMatrix; // Space allocation @@ -47,6 +47,7 @@ int pagerank(CooSparseMatrix *transitionMatrix, double **pagerankVector, *convergenceStatus = false; // Initialization + allocMemoryForCoo(&linksFromConvergedPages, transitionMatrix->numberOfNonZeroElements); for (int i=0; ielements[rowIndexes[j]]; - // Checks for links from converged pages to non converged - int pageLinksTo = element->columnIndex; - if (convergenceMatrix[pageLinksTo] == false){ - // Link exists, adds element to the vector - apendElement(&linksFromConvergedPages, - element->value, i, pageLinksTo); + // Checks if this converged page has an out-link to a non converged one + int rowStartIndex = transitionMatrix->rowCumulativeIndexes[i], + rowEndIndex = transitionMatrix->rowCumulativeIndexes[i+1]; + if (rowEndIndex > rowStartIndex) { + // This row (page) has non zero elements (out-links) + for (int j=rowStartIndex; jcolumnIndexes[j]; + if (convergenceMatrix[pageLinksTo] == false){ + // Link exists, adds element to the vector + addElement(&linksFromConvergedPages, + transitionMatrix->values[j], i, pageLinksTo); + } } } @@ -127,7 +132,7 @@ int pagerank(CooSparseMatrix *transitionMatrix, double **pagerankVector, zeroOutColumn(transitionMatrix, i); // Builds the new linksFromConvergedPagesPagerankVector - lilSparseMatrixVectorMultiplication(linksFromConvergedPages, + cooSparseMatrixVectorMultiplication(linksFromConvergedPages, *pagerankVector, &linksFromConvergedPagesPagerankVector, numberOfPages); } @@ -157,7 +162,7 @@ int pagerank(CooSparseMatrix *transitionMatrix, double **pagerankVector, free(convergedPagerankVector); free(linksFromConvergedPagesPagerankVector); free(convergenceMatrix); - destroyLilSparseMatrix(&linksFromConvergedPages); + destroyCooSparseMatrix(&linksFromConvergedPages); return iterations; } @@ -167,7 +172,7 @@ int pagerank(CooSparseMatrix *transitionMatrix, double **pagerankVector, * from the file and creates the initial transition probability distribution * matrix. */ -void initialize(CooSparseMatrix *transitionMatrix, +void initialize(CsrSparseMatrix *transitionMatrix, double **pagerankVector, Parameters *parameters) { // Reads web graph from file @@ -197,9 +202,6 @@ void initialize(CooSparseMatrix *transitionMatrix, for (int i=0; i<(*parameters).numberOfPages; ++i) { (*pagerankVector)[i] = webUniformProbability; } - - // Transposes the transition matrix (P^T). - transposeSparseMatrix(transitionMatrix); } // ==================== MATH UTILS ==================== @@ -208,14 +210,14 @@ void initialize(CooSparseMatrix *transitionMatrix, * calculateNextPagerank calculates the product of the multiplication * between a matrix and the a vector in a cheap way. */ -void calculateNextPagerank(CooSparseMatrix *transitionMatrix, +void calculateNextPagerank(CsrSparseMatrix *transitionMatrix, double *previousPagerankVector, double **pagerankVector, double *linksFromConvergedPagesPagerankVector, double *convergedPagerankVector, int vectorSize, double dampingFactor) { // Calculates the web uniform probability once. double webUniformProbability = 1. / vectorSize; - cooSparseMatrixVectorMultiplication(*transitionMatrix, previousPagerankVector, + csrSparseMatrixVectorMultiplication(*transitionMatrix, previousPagerankVector, pagerankVector, vectorSize); for (int i=0; i maxPageIndex) { maxPageIndex = fileTo; } - addElement(transitionMatrix, 1, fileFrom, fileTo); + addElement(&tempMatrix, 1, fileFrom, fileTo); } - printf("\n"); if ((*parameters).verbose) { printf("Max page index found is: %d\n", maxPageIndex); @@ -417,15 +414,15 @@ void generateNormalizedTransitionMatrixFromFile(CooSparseMatrix *transitionMatri // Calculates the outdegree of each page and assigns the uniform probability // of transition to the elements of the corresponding row - int currentRow = transitionMatrix->elements[0]->rowIndex, pageOutdegree = 1; - for (int i=1; isize; ++i) { - CooSparseMatrixElement *currentElement = transitionMatrix->elements[i]; + int currentRow = tempMatrix.elements[0]->rowIndex, pageOutdegree = 1; + for (int i=1; irowIndex == currentRow) { ++pageOutdegree; } else { double pageUniformProbability = 1. / pageOutdegree; for (int j=i-pageOutdegree; jelements[j]->value = pageUniformProbability; + tempMatrix.elements[j]->value = pageUniformProbability; } currentRow = currentElement->rowIndex; @@ -435,10 +432,18 @@ void generateNormalizedTransitionMatrixFromFile(CooSparseMatrix *transitionMatri // Does the last row double pageUniformProbability = 1. / pageOutdegree; - for (int j=transitionMatrix->size-pageOutdegree; jsize; ++j) { - transitionMatrix->elements[j]->value = pageUniformProbability; + for (int j=tempMatrix.size-pageOutdegree; jvalue = pageUniformProbability; } + // Transposes the temporary transition matrix (P^T). + transposeSparseMatrix(&tempMatrix); + + allocMemoryForCsr(transitionMatrix, numberOfEdges); + // Transforms the temporary COO matrix to the desired CSR format + transformToCSR(tempMatrix, transitionMatrix); + destroyCooSparseMatrix(&tempMatrix); + fclose(graphFile); } diff --git a/serial/serial_gs_pagerank_functions.h b/serial/serial_gs_pagerank_functions.h index 40ed518..a9fe200 100644 --- a/serial/serial_gs_pagerank_functions.h +++ b/serial/serial_gs_pagerank_functions.h @@ -10,7 +10,6 @@ #include #include "coo_sparse_matrix.h" -#include "lil_sparse_matrix.h" /* ===== DEFINITIONS ===== */ @@ -67,7 +66,7 @@ void parseArguments(int argumentCount, char **argumentVector, // them to populate the sparse array (transitionMatrix). The entries of the file // represent the edges of the web transition graph. The entries are then // modified to become the rows of the transition matrix. -void generateNormalizedTransitionMatrixFromFile(CooSparseMatrix *transitionMatrix, +void generateNormalizedTransitionMatrixFromFile(CsrSparseMatrix *transitionMatrix, Parameters *parameters); // Function savePagerankToFile appends or overwrites the pagerank vector @@ -78,14 +77,14 @@ void savePagerankToFile(char *filename, bool append, double *pagerankVector, // Function initialize allocates memory for the pagerank vector, reads the // dataset from the file and creates the transition probability distribution // matrix. -void initialize(CooSparseMatrix *transitionMatrix, double **pagerankVector, +void initialize(CsrSparseMatrix *transitionMatrix, double **pagerankVector, Parameters *parameters); // Function vectorNorm calculates the first norm of a vector. double vectorNorm(double *vector, int vectorSize); // Function calculateNextPagerank calculates the next pagerank vector. -void calculateNextPagerank(CooSparseMatrix *transitionMatrix, +void calculateNextPagerank(CsrSparseMatrix *transitionMatrix, double *previousPagerankVector, double **pagerankVector, double *linksFromConvergedPagesPagerankVector, double *convergedPagerankVector, int vectorSize, double dampingFactor); @@ -93,7 +92,7 @@ void calculateNextPagerank(CooSparseMatrix *transitionMatrix, // Function pagerank iteratively calculates the pagerank of each page until // either the convergence criterion is met or the maximum number of iterations // is reached. -int pagerank(CooSparseMatrix *transitionMatrix, double **pagerankVector, +int pagerank(CsrSparseMatrix *transitionMatrix, double **pagerankVector, bool *convergenceStatus, Parameters parameters); #endif // SERIAL_GS_PAGERANK_FUNCTIONS_H \ No newline at end of file