View source: R/edge_covariates.R
| edge_flow | R Documentation |
Builds an antisymmetric per-edge covariate from a spatial vector field (for
example wind or current), for use in directed gene-flow models.
edge_gradient takes the gradient of a scalar
potential, which is curl-free and yields a reversible generator whose
stationary distribution is collinear with the potential. A vector flow field
can carry a rotational/curl component instead, making the directed generator
non-reversible and its stationary distribution non-collinear with any scalar
covariate.
edge_flow(field, data)
field |
The vector field at the active graph cells: a two-column numeric
matrix or data frame (x- and y-components, in vertex order), a two-layer
|
data |
A |
For undirected edge (a, b) the covariate is the mean field along the edge
projected onto the edge direction,
c_{ab} = \tfrac{1}{2}(f_a + f_b) \cdot (xy_b - xy_a); it is antisymmetric
by construction, and a directed model applies -c_{ab} to the reverse
edge b \to a.
A numeric vector with one entry per undirected edge in
data$edge_pairs, ready to pass to a directed gene-flow model.
edge_gradient
coords <- as.matrix(expand.grid(x = 0:2, y = 0:2))
g <- deme_graph(coords, neighbours = "lattice")
field <- matrix(c(1, 0), nrow = nrow(coords), ncol = 2, byrow = TRUE)
edge_flow(field, g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.