Skip to content

Commit

Permalink
Fix #126
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Nov 7, 2023
1 parent 6966684 commit 08a95a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion R/centrality.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#' vector with measures ready to be added to the node data. Further `tidygraph`
#' provides access to the `netrankr` engine for centrality calculations and
#' define a number of centrality measures based on that, as well as provide a
#' manual mode for specifying more-or-less any centrality score.
#' manual mode for specifying more-or-less any centrality score. These measures
#' all only work on undirected graphs.
#'
#' @param weights The weight of the edges to use for the calculation. Will be
#' evaluated in the context of the edge data.
Expand Down Expand Up @@ -202,6 +203,9 @@ centrality_manual <- function(relation = 'dist_sp', aggregation = 'sum', ...) {
expect_netrankr()
expect_nodes()
graph <- .G()
if (is.directed(graph)) {
cli::cli_abort("Centrality measures based on the {.pkg netrankr} package only works on undirected networks")
}
rel <- netrankr::indirect_relations(graph, type = relation, ...)
netrankr::aggregate_positions(rel, type = aggregation)
}
Expand Down
3 changes: 2 additions & 1 deletion man/centrality.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 08a95a9

Please sign in to comment.