ahn_gen: Generate networks characterising habitat physical...

Description Usage Arguments Value Examples

View source: R/ahn_gen.R

Description

Generate undirected networks (weighted or unweighted, connected or disconnected) characterising the physical attributes and spatial organizations (or distributions) of habitat components (i.e. habitat configurations).

Usage

1
2
ahn_gen(N, L, mu, lamda, Connected = TRUE, Weighted = TRUE, eta = 1,
  A = 25, X = NULL, Y = NULL, U = NULL, V = NULL)

Arguments

N

The number of nodes

L

A side length of the rectangle landscape within which nodes are anchored

mu

the critical Dij (i.e. Euclidean distance between node i and j) at which the link removing probability curve P(Dij, mu, lamda) transits from concave to convex (see ahn_prob)

lamda

the steepness of the link removing probability curve P(Dij, mu, lamda), see ahn_prob

Connected

TRUE for connected while FALSE ignores whether the networks are connected or not

Weighted

TRUE for weighted while FALSE for unweighted networks

eta

mediates the weight, i.e. (Dij)^-eta, of the link rewiring node i from one network component and node j from another network component (i and j are with an Euclidean distance of Dij) when the network becomes disconnected after removing links from the initial complete network with the probability P(Dij, mu, lamda) = [1 + exp(-lamda(Dij - mu))]^-1 when both Connected = TRUE and Weighted = TRUE

A

The area of the rectangle landscape within which the network is defined

X

A vector of X coordinates for the N nodes (sampled from [0, L] uniformly at random if NULL)

Y

A vector of Y coordinates for the N nodes (sampled from [0, A/L] uniformly at random if NULL)

U

A vector with N elements specifying node attributes (qualitative or quantitive), by default NULL

V

A vector with N elements specifying node attributes (qualitative or quantitive), by default NULL

Value

Return an animal habitat network (an igraph object)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# generate a connected and weighted network
ahn_gen(N = 10, L = 5, mu = 1, lamda = 5)



N <- 10
x <- runif(N, 0, 5)
ql <- sample(LETTERS, N, replace = TRUE)
qn <- sample(1:20, N, replace = TRUE)

# specify the X coordinates, node attributes U and V for a connected and unweighted network
ahn_gen(N, L = 5, mu = 1, lamda = 5, Weighted = FALSE, X = x, U = ql, V = qn)

# specify the Y coordinates, node attributes U and V for a weighted network, no matter if the
# network will be connected or not
ahn_gen(N, L = 5, mu = 1, lamda = 5, Weighted = TRUE, Connected = FALSE, Y = x, U = ql, V = qn)

AnimalHabitatNetwork documentation built on Dec. 1, 2019, 1:14 a.m.