title: Calculating the degree matrix having the sparse representation of the adjacency matrix
body: <p>I am trying to calculate the laplacian matrix of a graph. I ve calculated the sparse representation of the adjacency matrix which is stored in a text file with dimension Nx3. N the size of nodes (ith-node jth node weight). I open in Matlab this file with <code>adj = spconvert(adj);</code>. The next step is to calculate the degree matrix of this sparse matrix  in order to perform the operation <code>L = D - adj</code>. How is it possible to calculate the degree matrix having as an input the sparse adjacency matrix of the graph? In order to calculate the degree matrix I calculate the degree for every node:</p>
  
  <pre><code>for i=1:n % size of the node
      degree(i) =  length(find(adj(:,1) == i &amp; adj(:,3) == 1));
  end
  </code></pre>
  
  <p>However, how can I perform the subtraction of D and A?</p>