public SparseMatrix makeLaplacian() { SparseMatrix laplacian = new SparseMatrix(this.rowDim, this.colDim); for (int r : this.getRows()) { Counter row = this.getRow(r); laplacian.set(r, r, row.sum()); for (int c : row.keySet()) { laplacian.set(r, c, -1 * row.get(c)); } } return laplacian; }