Learn R Programming

wdnet (version 1.2.3)

edgelist_to_wdnet: Creates a wdnet object using edgelist.

Description

Creates a wdnet object using edgelist.

Usage

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

Value

A wdnet object with the specified edgelist,

edgeweight and directed.

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.

Examples

Run this code
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
)

Run the code above in your browser using DataLab