Learn R Programming

netUtils (version 0.8.3)

sample_coreseq: Generate random graphs with a given coreness sequence

Description

Similar to sample_degseq just with coreness

Usage

sample_coreseq(cores)

Value

igraph object of graph with the same coreness sequence as the input

Arguments

cores

coreness sequence

Author

David Schoch

Details

The code is an adaption of the python code from https://github.com/ktvank/Random-Graphs-with-Prescribed-K-Core-Sequences/

References

Van Koevering, Katherine, Austin R. Benson, and Jon Kleinberg. 2021. ‘Random Graphs with Prescribed K-Core Sequences: A New Null Model for Network Analysis’. ArXiv:2102.12604. https://doi.org/10.1145/3442381.3450001.

Examples

Run this code
library(igraph)
g1 <- make_graph("Zachary")
kcores1 <- coreness(g1)
g2 <- sample_coreseq(kcores1)
kcores2 <- coreness(g2)

# the sorted arrays are the same
all(sort(kcores1) == sort(kcores2))

Run the code above in your browser using DataLab