igraph (version 0.5.4-1)

rewire.edges: Rewires the endpoints of the edges of a graph randomly

Description

This function rewires the endpoints of the edges with a constant probability uniformly randomly to a new vertex in a graph.

Usage

rewire.edges(graph, prob)

Arguments

graph
The input graph
prob
The rewiring probability, a real number between zero and one.

Value

  • A new graph object.

Details

Note that this function might create graphs with multiple and/or loop edges.

Examples

Run this code
# 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)

Run the code above in your browser using DataCamp Workspace