[P] 700x faster Node2Vec embeddings by CSR graph representation
I recently rewrote node2vec, which took a severely long time to generate random walks on a graph, by representing the graph as a CSR sparse matrix, and operating directly on the sparse matrix’s data arrays.
The result is a speedup from 30 hours to 3 minutes for a small sized graph (nodes and edges in the hundreds of thousands).
This raises bigger questions about graph representation for graph analytics — representing graphs as sparse matrices prevents node insertion, but makes operations much more efficient (though admitedly harder to write). More importantly, we can hold fairly huge graphs in RAM because the data usage is so lean.
If we’re analyzing graphs, we don’t care so much about adding nodes, so I think the future of graph analytics is in CSR representation.