# For unipartite network
data_uni <- FungusTreeNetwork$networks$tree_tree
# If the network is symmetric:
my_mat <- get_adjacency(data_uni$edges,
type = data_uni$type,
directed = FALSE
)
# If the network is directed:
my_mat <- get_adjacency(data_uni$edges,
type = data_uni$type,
directed = TRUE
)
# For bipartite network
data_bi <- FungusTreeNetwork$networks$fungus_tree
my_mat <- get_adjacency(data_bi$edges, type = data_bi$type)
# In any case with a 2 columns data.frames the network is considered binary and each line is a 1.
binary_net <- FungusTreeNetwork$fungus_tree$edges[, -3]
my_mat <- get_adjacency(binary_net, type = data_bi$type)
Run the code above in your browser using DataLab