I write the following:
We represent ~~ as a simple graph $G(N,E)$, where $N$ and $E$ are node and edge set, respectively, defined by \begin{align} N &= \{x_1, x_2, \ldots, x_{30}, y_1, y_2, \ldots, y_{20}\},\\ E &= \{(u,v)\in N\times N: u \ne v, \tau(u) + \tau(v) \le 10\}. \end{align}
I already introduced what $x_i$s and $y_i$s are, and defined the function $\tau$ before the above sentence.
For my eyes, $u\ne v$ look like very strange, also I do not know which is more correct between $(u,v) \in N\times N$ and $(u,v) \in N^2$.
Is there better formal notation for the above?
First of all, $N \times N$ and $N^2$ are both correct. Next, since you are talking about a simple graph, the condition $u \not= v$ is implicit. That being said, you could say something like