addd commented code that might work better than the currnt one
optimization: only insert transposed pair in coo. matrix when intended pair is also inserted