SachaEpskamp / qgraph

Developmental version of qgraph
GNU General Public License v2.0
68 stars 21 forks source link

smallworldness() is biased #69

Open szhorvat opened 1 year ago

szhorvat commented 1 year ago

The smallworldness() function uses degree.sequence.game(deg.dist, method="simple.no.multiple") to sample random graphs with the same degree sequence as the input graph:

https://github.com/SachaEpskamp/qgraph/blob/master/R/centralityFunctions.R#L336

Note that "simple.no.multiple" does not sample uniformly, so the result will be biased. I recommend you use rewire(with=keeping_degseq(...)) instead, which does sample uniformly in the limit of a large number of rewiring steps. You should probably verify that the graph is simple before doing this.

Aside: the deg.dist variable name is a misnomer. Currently this variable holds the degree sequence, not the degree distribution.

Note that degree.sequence.game() has been renamed to sample_degseq(). The old name works but it's deprecated.

SachaEpskamp commented 1 year ago

Thanks for the tips! This is not something I am actively developing, but maybe @GiulioCostantini who wrote this function can take a look.