I want to generate a sparse matrix B for a given array A. A contains two columns of indecis. For example,
The sparse matrix B should be as follows:
The characteristics of B:
- Sum of each row is zero.
- If we consider matrix A gives the information of edges of a graph, B(i,i) = sum of number of edges, B(i,j) = -1 if there is an edge between i and j.
Thanks a lot.