Binary Array Graph
Usage
new_barry_graph(x, ...)
# S3 method for class 'matrix'
new_barry_graph(x, n, ...)
# S3 method for class 'list'
new_barry_graph(x, ...)
netsize(x)
nnets(x)Value
new_barry_graph() returns an external pointer object of class
"barry_graph" with attributes netsize (integer scalar giving the
size of each individual network) and endpoints (integer vector
marking the boundary rows of the stacked networks).
The function netsize() returns the size of individual networks
(all matching).
nnets() returns the number of graphs contained in the barry_graph
object.
Details
When x is a matrix, it is assumed that it will be a block
diagonal matrix, with the first block corresponding to the reference
(true) network.
If x is a list, the first matrix is assumed to be the reference
(true) network.
Examples
# Using the Krackhardt advice network
data(krackhardt_advice)
data(krackhardt_advice_perceptions)
# Convert edge-list data frame to adjacency matrix
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)
)
krack_graph
#> A barry_graph with 22 networks of size 21
#> . . 1.00 . 1.00 . . . 1.00 . .
#> . . . . . 1.00 1.00 . . .
#> 1.00 1.00 . 1.00 . 1.00 1.00 1.00 1.00 1.00
#> 1.00 1.00 . . . 1.00 . 1.00 . 1.00
#> 1.00 1.00 . . . 1.00 1.00 1.00 . 1.00
#> . . . . . . . . . .
#> . 1.00 . . . 1.00 . . . .
#> . 1.00 . 1.00 . 1.00 1.00 . . 1.00
#> 1.00 1.00 . . . 1.00 1.00 1.00 . 1.00
#> 1.00 1.00 1.00 1.00 1.00 . . 1.00 . .
#> Skipping 452 rows. Skipping 452 columns.
# Network size and number of networks
netsize(krack_graph)
#> [1] 21
nnets(krack_graph)
#> [1] 21