% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/graphettes.R
\name{sample_graphette}
\alias{sample_graphette}
\title{Samples a graph from a graphette}
\usage{
sample_graphette(
  W,
  rho_n = NULL,
  graph_edit_f = NULL,
  n = 100,
  t_or_p = 0.5,
  ring_sizes = c(5, 6)
)
}
\arguments{
\item{W}{The graphon. This is a symmetric matrix with values in [0,1]}

\item{rho_n}{A function. Default is 1.}

\item{graph_edit_f}{The graph edit function. For star functions it can be
one of \code{'star_f1'}, \code{'star_f2'}, \code{'star_f3'}, \code{'star_f4'} or \code{'star_f5'}. To add rings, it needs to be \code{'add_rings'}. The function \code{'remove_cycles'} removes cycles.}

\item{n}{The number of nodes in the graph to sample}

\item{t_or_p}{The parameter for star function or the ring function. For the
ring function it needs to be between 0 and 1.}

\item{ring_sizes}{The size of rings to add if the graph edit function is the ring function. default values set to \code{c(5,6)}.}
}
\value{
gr A graph sampled from rho_n W.
}
\description{
Samples a graph from a graphette given by (W, a_n, f), where W is the graphon, a_n is generally a sequence converging to zero and f is a graph edit funcion.
}
\examples{
library(igraph)
# Example 1
f1 <- function(n) 10/n
W <- matrix(0.2, nrow = 100, ncol = 100)
gr <- sample_graphette(W, rho_n = f1, graph_edit_f = 'add_rings', n = 100, t_or_p = 0.5)
gr

# Example 2
gr <- sample_graphette(W, rho_n = f1, graph_edit_f = 'star_f1', n = 100, t_or_p = 3)
gr
}
