permute.vertices {igraph} | R Documentation

## Permute the vertices of a graph

### Description

Create a new graph, by permuting vertex ids.

### Usage

    permute.vertices(graph, permutation)

### Arguments

`graph` | The input graph, it can directed or undirected.
`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 `vcount(graph)-1` must appear exactly once.

### Details

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 `canonical.permutation` to create the canonical form of a graph.

### Value

A new graph object.

### Author(s)

Gabor Csardi csardi@rmki.kfki.hu

### See Also

`canonical.permutation`

### Examples

    # 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)

[Package igraph version 0.5.2 Index]