View source: R/create_hypergraphs.R
hype_from_inc_mat | R Documentation |
Create a Hypergraph From an Incidence Matrix
hype_from_inc_mat(inc_mat, directed = FALSE, real_coef = FALSE)
inc_mat |
An incidence matrix or, for an oriented hypergraph, a list of two incidence matrices. |
directed |
A logical value representing whether the hypergraph should be directed. |
real_coef |
A logical value representing whether the hypergraph should have real coefficients associating vertices to hyperedges. |
A hypergraph object with the given incidence structure.
i1 <- matrix( c(1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0), nrow = 5, ncol = 3, dimnames = list( paste0("v", 1:5), paste0("h", 1:3) ) ) hype1 <- hype_from_inc_mat(i1) i2 <- list( matrix( c(1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0), nrow = 4, ncol = 3, dimnames = list( paste0("v", 1:4), paste0("h", 1:3) ) ), matrix( c(0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0), nrow = 4, ncol = 3, dimnames = list( paste0("v", 1:4), paste0("h", 1:3) ) ) ) hype2 <- hype_from_inc_mat(i2) hype3 <- hype_from_inc_mat(i2, directed = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.