igraph-help
[Top][All Lists]

## Re: [igraph] Assortativity value NaN for regular networks

 From: Szabolcs Horvát Subject: Re: [igraph] Assortativity value NaN for regular networks Date: Mon, 2 Apr 2018 11:47:10 +0200

Hello Borja,

If you go back to the mathematical definition of assortativity, it makes perfect sense.  It is a normalized correlation.  If all degrees are the same, then the correlation is 0, and so is the variance, 0/0 -> NaN.  If the degrees are *almost* the same, then the correlation is almost zero, the variance is nonzero, verysmall / nonzero -> verysmall.

Intuitively, your regular network is not special among networks with the same degrees: the vertices have no choice but to connect to other vertices of the same degree.  Compare with networks with a wide range of degrees present: some of these are assortative, some aren't. Unlike in the case of regular graphs, there's a freedom.

On 2 April 2018 at 10:36, Borja Esteve-Altava wrote:
Hi everyone,

I want to use the assortativity degree as a ways of estimating the level of homogeneity / heterogeneity of real networks:
1 = homogeneous (all vertices having degree k, they all connect to vertices with degree k)
-1 = heterogeneous

It seems to work fine for the extreme case of heterogeneity:

> assortativity_degree(make_star(25, mode = "undirected"), directed=FALSE)
[1] -1

However, for the other extreme of homogeneity (e.g., regular networks) the function assortativity_degree() does not return a value of 1, but a NaN.

> assortativity_degree(make_lattice(c(1, 5, 5), circular=T), directed=FALSE)
[1] NaN

When I tried to do an "almost-regular" network by deleting one edge in the regular, instead of getting a close to 1 value I got a close to 0 value.

> assortativity_degree(make_lattice(c(1, 5, 5), circular = T) %>% delete_edges(1), directed=F)
[1] -0.06521739

Any clue why regular networks do not show values of 1?
Am I missing something about how assortativity is calculated?

Thanks a lot!
--
Borja

_______________________________________________
igraph-help mailing list