Consider a simple undirected graph with $n$ elements. Let $A$ be the adjacency matrix of the graph with elements $a_{ij}$. Let $L$ be the graph Laplacian with $L=D-A$ where $D$ is the degree matrix. Let $N_i$ be the neighbor set of agent $i$.
I did some sample graphs and I see that
$$\sum_{i=1}^n \left[\sum_{j\in N_i} (y_i-y_j) \right]^2 = y^T(2L)y$$
I was hoping to see $y^TL^TLy$ but it never seemed to be the case. Why and when is the above condition true?