title: Sum the edge in adjacency matrix according to group label in numpy array
body: <p>For example, I got the symmetric adjacency matrix(no self-loop), i.e</p>
  <pre class="lang-py prettyprint-override"><code>A = 
  [
  [0, 1, 1, 0, 0],
  [1, 0, 1, 0, 1],
  [1, 1, 0, 1, 0],
  [0, 0, 1, 0, 1],
  [0, 1, 0, 1, 0]]
  </code></pre>
  <p>Then, I got an array of cluster label i,  associated with this graph,  i.e</p>
  <pre class="lang-py prettyprint-override"><code>cluster = [1,1,2,2,3]
  </code></pre>
  <p>It means that the node 1 and node 2 are in the same group, node 3 and node 4 are in the same group, node 5 are in a independent group.</p>
  <p>The question is that how can I get the sum of the edges within groups and between groups,</p>
  <p>Within groups: means the edge between nodes that share the same cluster label, for example, node 1 and node 2 are the in the same group, so the sum is 1 for them, the same for node 3 and node 4. For node 5, its 0.</p>
  <p>Between groups: means the edge between nodes that share different cluster label,  for example, group 1 and group 2, it means that sum the edge of, node 1  node 3, node 1 node 4, node 2 node 3, node 2 node 4. The answer is 2 between group 1 and group 2.</p>
  <p>then return a 2d symmetric array contains the result, i.e</p>
  <pre class="lang-py prettyprint-override"><code>[[1,2,1],
  [2,1,1],
  [1,1,0]]
  </code></pre>