adjustAvgDegree: Adjust the average degree of a supply network

Description Usage Arguments Value Examples

View source: R/rewiring.R

Description

During a rewiring process, several operations such as nodes deletion can make change the average degree of a graph. This function aims to re-adjust the number of edges to a given level by adding or deleting edges randomly.

Usage

1
adjustAvgDegree(g, avg.degree = 1.470968, ...)

Arguments

g

an igraph object.

avg.degree

numeric; the expected average degree.

...

other arguments passed to addRandomEdges to constrain the add of edges. For example, if we want the edges to be added to long supply chains, we pass v2connect=V(g)[type=="I"]

Value

an igraph object.

Examples

1
2
3
4
5
6
7
library(igraph)
g = generateSupplyNet()
plot(g)
ecount(g) / vcount(g)
g = adjustAvgDegree(g, avg.degree=3)
ecount(g) / vcount(g)
plot(g)

MiloMonnier/supplynet documentation built on Feb. 16, 2021, 8:03 p.m.