Skip to contents

See the links below for the implemented rewiring methods.

Usage

rewire(graph, with)

Arguments

graph

The graph to rewire

with

A function call to one of the rewiring methods, see details below.

Value

The rewired graph.

See also

Other rewiring functions: each_edge(), keeping_degseq()

Examples

g <- make_ring(10)
g %>%
  rewire(each_edge(p = 0.1, loops = FALSE)) %>%
  plot(layout = layout_in_circle)

print_all(rewire(g, with = keeping_degseq(niter = vcount(g) * 10)))
#> ── <igraph> Ring graph ────────────────────────────────────────────── c5cd811 ──
#>  undirected
#>  10 vertices · 10 edges
#> 
#> ── Attributes ──────────────────────────────────────────────────────────────────
#> → graph:  name <chr>, mutual <lgl>, circular <lgl>
#> 
#> ── Graph attributes ────────────────────────────────────────────────────────────
#> name:
#>   [1] "Ring graph"
#> mutual:
#>   [1] FALSE
#> circular:
#>   [1] TRUE
#> 
#> ── Edges ───────────────────────────────────────────────────────────────────────
#>  [1] 1 ─ 6   2 ─ 9   4 ─ 8   3 ─ 4   3 ─ 9   5 ─ 8   1 ─ 10  7 ─ 10  2 ─ 6  
#> [10] 5 ─ 7