The (product moment) graph correlation between labeled graphs G and H is given by
$$cor(G,H) = \frac{cov(G,H)}{\sqrt{cov(G,G) cov(H,H)}} $$
where the graph covariance is defined as
$$cov(G,H) = \frac{1}{{|V| \choose 2}} \sum_{\{i,j\}} \left(A^G_{ij}-\mu_G\right)\left(A^H_{ij}-\mu_H\right)$$
(with \(A^G\) being the adjacency matrix of G). The graph correlation/covariance is at the center of a number of graph comparison methods, including network variants of regression analysis, PCA, CCA, and the like.

Note that `gcor`

computes only the correlation between *uniquely labeled* graphs. For the more general case, `gscor`

is recommended.