Skip to content
Snippets Groups Projects

adding new function

Merged Marek Ostaszewski requested to merge Rcode into master
Files
5
+ 18
0
# create_bipartite_graph.R
#' Function that creates a bipartite graph from the components of a given map/project on the MINERVA Platform.
#' The function produces an igraph object
#'
#' @param map_components (`list`) a list of map components
#'
#' @return (`igraph`) an igraph object with the bipartite representation of the map
#' @examples
#'
#' create_bipartite_graph(example_map_components)
#'
#' @export
create_bipartite_graph <- function(map_components) {
r_df <- purrr::map(map_components$map_reactions, create_bipartite_reaction_df) %>%
purrr::reduce(rbind)
igraph::graph.data.frame(r_df)
}
Loading