\HeaderA{rewire}{Graph rewiring}{rewire}
\keyword{graphs}{rewire}
\begin{Description}\relax
Randomly rewires a graph while preserving the degree
distribution.
\end{Description}
\begin{Usage}
\begin{verbatim}
rewire(graph, mode = "simple", niter = 100) 
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{graph}] The graph to be rewired.
\item[\code{mode}] The rewiring algorithm to be used. It can be one of the
following: \code{simple}: simple rewiring algorithm which
chooses two arbitrary edges in each step (namely (a,b) and (c,d))
and substitutes them with (a,d) and (c,b) if they don't yet exist.
\item[\code{niter}] Number of rewiring trials to perform.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This function generates a new graph based on the original one by
randomly rewiring edges while preserving the original graph's degree
distribution.
\end{Details}
\begin{Value}
A new graph object.
\end{Value}
\begin{Author}\relax
Tamas Nepusz \email{ntamas@rmki.kfki.hu} and
Gabor Csardi \email{csardi@rmki.kfki.hu}
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{degree.sequence.game}{degree.sequence.game}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
g <- graph.ring(20)
g2 <- rewire(g, niter=3)
\end{ExampleCode}
\end{Examples}

