construct the CSR graph representation in-place