Compute the block sum of an adjacency matrix given a label vector.

compute_block_sums(A, z)

Arguments

A

adjacency matrix.

z

label vector.

Value

A K x L matrix with (k,l)-th element as \(sum_{i,j} A_{i,j} 1{z_i = k, z_j = l}\)