dprewire_undirected: Degree preserving rewiring for undirected networks

View source: R/rewire.R

dprewire_undirectedR Documentation

Degree preserving rewiring for undirected networks

Description

Degree preserving rewiring towards the target structure eta.

Usage

dprewire_undirected(
  edgelist,
  eta,
  iteration = 200,
  nattempts,
  rewire.history = FALSE
)

Arguments

edgelist

A two column matrix, each row represents an undirected edge.

eta

A matrix generated by wdnet::get_eta_undirected().

iteration

An integer, number of rewiring iterations, each iteration consists of nattempts rewiring attempts.

nattempts

An integer, number of rewiring attempts for each iteration. The default value equals the number of rows in edgelist.

rewire.history

Logical, whether the rewiring history should be returned.

Value

Rewired edgelist, assortativity coefficient after each iteration, and rewiring history (including the index of sampled edges and rewiring result). For each rewiring attempt, two rows are sampled from the edgelist, for example Edge1:{v_1, v_2} and Edge2:{v_3, v_4}, the function try to rewire the sampled edges as {v_1, v_4}, {v_3, v_2} (rewire type 1) or {v_1, v_3}, {v_2, v_4} (rewire type 2) with probability 1/2.


wdnet documentation built on May 29, 2024, 9:32 a.m.