----
> [!definition] Definition. ([[assortativity coefficient]])
> Let $G$ be a [[network]] with $n$ nodes and $m$ edges and [[adjacency matrix]] $A$, $S$ an [[ordered set]] (e.g., $\mathbb{R}$), and consider some ordered characteristic $x:G \to S, i \mapsto x_{i}$ of the nodes of $G$ — (e.g., age or income). The **assortativity coefficient of $G$ with respect to $x$** is $r_{x}:= \frac{\sum_{i,j \in [n]}^{}\left( A_{ij} - \frac{k_{i}k_{j}}{2m} \right)x_{i}x_{j}}{\sum_{i,j \in [n]}^{}\left( k_{i} \delta_{ij} - \frac{k_{i}k_{j}}{2m} \right)x_{i}x_{j}}.$
> \
> **Remark.** Although it isn't obvious, this is in fact an example of a [[Pearson correlation coefficient]].
>
> [!justification]
> This definition arises as follows. The mean $\mu$ of the value of $x_{i}$ *at the end of an edge* is defined as follows: $\mu:= \frac{\sum_{i,j \in [n]}^{} A_{ij}x_{i}}{\underbrace{\sum_{i,j \in [n]}^{} A_{ij}}_{=2m}}=\frac{1}{2m}\sum_{i=1}^{n}k_{i}x_{i},$
where we note that since a node $i$ with degree $k_{i}$ lies at $k_{i}$ ends of edges, that node appears $k_{i}$ times in the sum.
\
Then the [[covariance]] of $x_{i}$ and $x_{j}$ over edges is $\begin{align}
\cov(x_{i},x_{j})= & \frac{\sum_{i,j \in [n]}^{} A_{ij}(x_{i}-\mu)(x_{j} - \mu)}{\sum_{i,j \in [n]}^{}A_{ij}} \\
= & \frac{1}{2m} \sum_{i,j \in [n]}^{}A_{ij}(x_{i}x_{j} - \mu x_{i} - \mu x_{j} + \mu^{2}) \\
= & \frac{1}{2m} \sum_{i,j \in [n]}^{} A_{ij}x_{i}x_{j} - \mu^{2} \\
= & \frac{1}{2m} \sum_{i, j in [n]}^{} A_{ij}x_{i}x_{j} - \frac{1}{(2m)^{2}} \sum_{i,j \in [n]}^{} k_{i}k_{j}x_{i}x_{j} \\
= & \frac{1}{2m} \sum_{i,j \in [n]}^{} \left( A_{ij} - \frac{k_{i}k_{j}}{2m} \right) x_{i}x_{j},
\end{align}$
where in the third step we used that $\frac{1}{2m}\sum_{i,j \in [n]}^{}A_{ij}\mu x_{i}=\mu^{2}=\frac{1}{2m}\sum_{i,j \in [n]}^{}A_{ij}\mu x_{j}$.
\
The expression we've obtained is quite similar that of [[modularity]]. We now normalize it to obtain the resulting definition (see the book.)
----
####
----
#### References
> [!backlink]
> ```dataview
> TABLE rows.file.link as "Further Reading"
> FROM [[]]
> FLATTEN file.tags as Tag
> WHERE Tag = "#definition" OR Tag = "#theorem" OR Tag = "#MOC" OR Tag = "#proposition" OR Tag = "#axiom"
> GROUP BY Tag
> ```
> [!frontlink]
> ```dataview
> TABLE rows.file.link as "Further Reading"
> FROM outgoing([[]])
> FLATTEN file.tags as Tag
> WHERE Tag = "#definition" OR Tag = "#theorem" OR Tag = "#MOC" OR Tag = "#proposition" OR Tag = "#axiom"
> GROUP BY Tag
> ```