Skip to contents

Convert an Adjacency List to an Edge Matrix

Usage

convert.adjacency.to.edge.matrix(adj.list, weight.list = NULL)

Arguments

adj.list

A 1-based adjacency list.

weight.list

Optional edge-weight list aligned with adj.list.

Value

A list with edge.matrix and weights.

Examples

graph <- list(c(2L, 3L), 1L, 1L)
convert.adjacency.to.edge.matrix(graph)
#> $edge.matrix
#>      [,1] [,2]
#> [1,]    1    2
#> [2,]    1    3
#> 
#> $weights
#> [1] 1 1
#>