The goal of graphonmix is to generate dense or sparse graphs via different techniques. We explore -mixture graphs and graphettes. -mixture graphs are generated from a standard dense graphon and a disjoint clique graphon , which acts as the sparse graph generator. Graphettes are a triple consisting of a graphon , a sparsifing sequence with and graph edit function . -mixture graphs are discussed in (Kandanaarachchi and Ong 2026) and graphettes are discussed in (Wijesinghe et al. 2026).
Installation
You can install the development version of graphonmix from GitHub with:
# install.packages("pak")
pak::pak("sevvandi/graphonmix")Mixture Example
This is a basic example on how to sample a -mixture graph.
library(graphonmix)
library(igraph)
#>
#> Attaching package: 'igraph'
#> The following objects are masked from 'package:stats':
#>
#> decompose, spectrum
#> The following object is masked from 'package:base':
#>
#> union
# create the dense graphon W(x,y) = 0.1
W <- matrix(0.1, nrow = 100, ncol = 100)
# create the sparse part - a disjoint set of stars
wts <- c(0.5, 0.3, 0.2)
# single function to generate a graph mixture
gr1 <- sample_mixed_graph(W, wts, nd = 100, ns = 300, p = 0.5, option = 2)
plot(gr1,
edge.curved = 0.3,
vertex.size = degree(gr1)*0.1,
edge.color = "lightgray", # Light colored edges
vertex.label = NA,
vertex.color = "lightblue",
main = "(U,W) Graph mixture"
)
Graphette example
This is an example with and $f = $ star_f1. The graph edit function star_f1 adds stars using a Poisson process.
rho <- function(n) 20/n
gr <- sample_graphette(W,
rho_n = rho,
graph_edit_f = 'star_f1',
n = 200,
t_or_p = 2)
plot(gr, vertex.label = NA, vertex.size = 3)
