\HeaderA{permute.vertices}{Permute the vertices of a graph}{permute.vertices}
\keyword{graphs}{permute.vertices}
\begin{Description}\relax
Create a new graph, by permuting vertex ids.
\end{Description}
\begin{Usage}
\begin{verbatim}
permute.vertices(graph, permutation)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{graph}] The input graph, it can directed or undirected.
\item[\code{permutation}] A numeric vector giving the permutation to
apply. The first element is the new id of vertex 0, etc. Every
number between zero and \code{vcount(graph)-1} must appear exactly
once.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
This function creates a new graph from the input graph by permuting
its vertices according to the specified mapping. Call this function
with the output of \code{\LinkA{canonical.permutation}{canonical.permutation}} to create
the canonical form of a graph.
\end{Details}
\begin{Value}
A new graph object.
\end{Value}
\begin{Author}\relax
Gabor Csardi \email{csardi@rmki.kfki.hu}
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{canonical.permutation}{canonical.permutation}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
# Random permutation of a random graph
g <- random.graph.game(20, 50, type="gnm")
g2 <- permute.vertices(g, sample(vcount(g))-1)
graph.isomorphic(g, g2)
\end{ExampleCode}
\end{Examples}

