Skip to contents

Convert a Weighted Adjacency Matrix to Lists

Usage

convert.weighted.adjacency.matrix.to.adjacency.list(A)

Arguments

A

Numeric square adjacency matrix.

Value

A list with adj.list and weight.list.

Examples

A <- matrix(c(0, 1, 0, 1, 0, 2, 0, 2, 0), nrow = 3)
convert.weighted.adjacency.matrix.to.adjacency.list(A)
#> $adj.list
#> $adj.list[[1]]
#> [1] 2
#> 
#> $adj.list[[2]]
#> [1] 1 3
#> 
#> $adj.list[[3]]
#> [1] 2
#> 
#> 
#> $weight.list
#> $weight.list[[1]]
#> [1] 1
#> 
#> $weight.list[[2]]
#> [1] 1 2
#> 
#> $weight.list[[3]]
#> [1] 2
#> 
#>