Given two $n\times n$ adjacency matrices $A,B$ where $A_{ij} \in \{0,1\}, A_{ii}=0, A_{ab}=0$ and $B$ is a matrix with only a single element $B_{ab}=1$ and zero everywhere else. Is there a formula for performing the calculation $(A+B)^3$? I think that I can use binomial expansion only if A and B commute. I am struggling to determine whether or not this is always possible with my setup.
Thanks in advance, Ben