The entry at row
i
, column
j
of
A
2
is the number of different paths of length 2 in
G
from vertex
i
to vertex
j
.