\HeaderA{rewire.edges}{Rewires the endpoints of the edges of a graph randomly}{rewire.edges}
\keyword{graphs}{rewire.edges}
\begin{Description}\relax
This function rewires the endpoints of the edges with a
constant probability uniformly randomly to a new vertex in a graph.
\end{Description}
\begin{Usage}
\begin{verbatim}
rewire.edges(graph, prob)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{graph}] The input graph
\item[\code{prob}] The rewiring probability, a real number between zero and
one.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Note that this function might create graphs with multiple and/or loop
edges.
\end{Details}
\begin{Value}
A new graph object.
\end{Value}
\begin{Author}\relax
Gabor Csardi \email{csardi@rmki.kfki.hu}
\end{Author}
\begin{Examples}
\begin{ExampleCode}
# Some random shortcuts shorten the distances on a lattice
g <- graph.lattice( length=100, dim=1, nei=5 )
average.path.length(g)
g <- rewire.edges( g, prob=0.05 )
average.path.length(g)
\end{ExampleCode}
\end{Examples}

