in reply to creating adjacency matrix

I have an add on question, how can I increase the value 1 , if the adjacent pair appears more then just one time? Like if A B appears 3 times, then in the matrix A B A 0 3 B 3 0