R/aaa.R

Defines functions expect_netswan expect_seriation expect_netrankr expect_influencer compress_rank as_node_ind as_ind `%gr_attr%`

#' @importFrom igraph graph_attr graph_attr<-
`%gr_attr%` <- function(e1, e2) {
  graph_attr(e1) <- graph_attr(e2)
  attributes(e1) <- attributes(e2)
  e1
}

as_ind <- function(i, length) {
  seq_len(length)[i]
}

#' @importFrom igraph gorder
as_node_ind <- function(i, graph) {
  if (!missing(i)) {
    i <- with_graph(unfocus(graph), {{i}})
  }
  as_ind(i, gorder(graph))
}

compress_rank <- function(x) {
  match(x, sort(x))
}

expect_influencer <- function(...) {
  rlang::check_installed('influenceR', ...)
}
expect_netrankr <- function(...) {
  rlang::check_installed('netrankr', ...)
}
expect_seriation <- function(...) {
  rlang::check_installed('seriation', ...)
}
expect_netswan <- function(...) {
  rlang::check_installed('NetSwan', ...)
}

Try the tidygraph package in your browser

Any scripts or data that you put into this service are public.

tidygraph documentation built on June 22, 2024, 11:32 a.m.