0

I have a 3*3 Adjacency matrix and I'm trying to sum the elements of each column and divide each column element by that sum to get the transition matrix. Can you please help me code this part? Thanks in advance.

VishwaV
  • 379
  • 3
  • 6
  • 18

1 Answers1

1

Considering a is your adjacency matrix 2D numpy array :

a / a.sum(axis=0)

Should do the trick (divide all elements by columns sum)

Elliot
  • 1,081
  • 7
  • 13