Processing graphs and sparse matrices efficiently