According to the code, B is a one-dimensional array obtained by calling A.sum(axis=1), representing the degree of each node. Therefore, one-dimensional index should be used instead of two-dimensional index in updateDeg function. The way to fix this is to use B[i] directly to get the node's degree, instead of B[i, 0].
I'm not sure if this is the case.