Skip to contents

Retrieves the edgelist of a barry_graph

Usage

barray_to_edgelist(x)

Arguments

x

An object of class barry_graph.

Value

A matrix with two columns, the first one with the source and the second one with the target.

Examples

data(krackhardt_advice)
data(krackhardt_advice_perceptions)

n_people <- 21
advice_matrix <- matrix(0L, nrow = n_people, ncol = n_people)
advice_matrix[cbind(krackhardt_advice$from, krackhardt_advice$to)] <-
  krackhardt_advice$value

krack_graph <- new_barry_graph(
  c(list(advice_matrix), krackhardt_advice_perceptions)
)
head(barray_to_edgelist(krack_graph))
#>      source target
#> [1,]      1      2
#> [2,]      1      4
#> [3,]      1      8
#> [4,]      1     16
#> [5,]      1     18
#> [6,]      1     21