knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of adjHelpR is to provide tools to generate adjacency matrices from weighted edgelists, create weighted edgelists from edgelists with repeated edges, and handle these objects.
It exploits dplyr
and tibble
s to deal efficiently with large edgelists, and Matrix
sparse matrices to store adjacency matrices in sparse format.
You can install the released version of adjHelpR from CRAN with:
install.packages("adjHelpR")
And the development version from GitHub with:
# install.packages("devtools") devtools::install_github("gi0na/adjHelpR")
This is a basic example on how to generate a weighted adjacency matrix from an edge list:
library(adjHelpR) el <- data.frame(from= c('a','b','b','c','d','d'), to = c('b','c','d','a','b','a'), attr= c( 12, 6, 12 , 6 , 6 , 6 )) (adj <- get_adjacency(el)) (el_unweighted <- tibble::as_tibble(do.call(rbind, apply(el, 1, function(row) matrix(rep(row[1:2], each=as.integer(row[3])), ncol = 2))), .name_repair='minimal')) (adj <- get_adjacency(el_unweighted, multiedge = TRUE))
The research and development behind adjHelpR
is performed at the Chair of Systems Design, ETH Zürich.
adjHelpR
is licensed under the GNU Affero General Public License.
(c) Copyright ETH Zürich, 2019-2021
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.