pkarakal/vertexwise-triangle-counting

Count triangles using the adjacency matrix of the graph

Closed this issue · 0 comments

The [i][j] element of the matrix-matrix product A*A is equal to the number of possible walks from node i to node j of length exactly 2, i.e. how many k exist that I can go from i to k and then from k to j. If there is also an edge A[i][j], then that is the number of triangles we are after!
Formally, the number of triangles c3 incident with each node is

c3=(A⊙(AA))e/2
  • Check the validity of the formula by implementing it in a high-level language (fixed in #4 )
  • Using the CSC storage scheme, implement in C/C++ the sparse matrix-vector product C=Av, where v is a dense vector. Validate your implementation by comparing your results against multiple matrices A and vectors v
  • Parallelize the code using OpenCilk, OpenMP, PThreads