adjacency matrix sum of corresponding rows and columns : <p>What is the easiest way to sum the rows and columns, of the same index, on an adjacency matrix?</p>

<p>Here is one example:</p>

<pre><code>      A  B  C  D
    A 1  0  2  1
    B 3  -  -  -
    C 0  -  -  -
    D 1  -  -  -
</code></pre>

<p>where the (-) are entries. How can I sum the A column with A row, B column with B row....</p>

<p>example, for A: (1 + 0 + 2 + 1) + (1 + 3 + 0 + 1) = 9</p>
