edgelist_to_wdnet {wdnet}R Documentation

Creates a wdnet object using edgelist.

Description

Creates a wdnet object using edgelist.

Usage

edgelist_to_wdnet(edgelist, edgeweight, directed, nodegroup, ...)

Arguments

edgelist

A two-column matrix representing the edges.

edgeweight

A numeric vector of edge weights with the same length as the number of rows in edgelist. If NULL, all edges will be assigned weight 1.

directed

Logical, whether the network is directed (TRUE) or undirected (FALSE).

nodegroup

A numeric vector of node groups.

...

Additional components to be added to the wdnet object.

Value

A wdnet object with the specified edgelist, edgeweight and directed.

Examples

edgelist <- matrix(c(1, 2, 2, 3, 3, 1), ncol = 2, byrow = TRUE)
edgeweight <- c(1, 2, 3)
nodegroup <- c(1, 1, 2)
netwk <- edgelist_to_wdnet(
  edgelist = edgelist,
  edgeweight = edgeweight,
  directed = TRUE,
  nodegroup = nodegroup
)


[Package wdnet version 1.2.3 Index]