Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rm igraph::estimate_ functions that will soon be deprecated #174

Merged
merged 2 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Description: A graph, while not "tidy" in itself, can be thought of as two tidy
a lot of common graph algorithms.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Roxygen: list(markdown = TRUE)
Imports:
tibble,
Expand Down
3 changes: 0 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,6 @@ importFrom(igraph,edge_connectivity)
importFrom(igraph,ego)
importFrom(igraph,ego_size)
importFrom(igraph,eigen_centrality)
importFrom(igraph,estimate_betweenness)
importFrom(igraph,estimate_closeness)
importFrom(igraph,estimate_edge_betweenness)
importFrom(igraph,girth)
importFrom(igraph,gorder)
importFrom(igraph,graph_attr)
Expand Down
33 changes: 13 additions & 20 deletions R/centrality.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ centrality_authority <- function(weights = NULL, scale = TRUE, options = igraph:
}
authority_score(graph = .G(), scale = scale, weights = weights, options = options)$vector
}
#' @describeIn centrality Wrapper for [igraph::betweenness()] and [igraph::estimate_betweenness()]
#' @importFrom igraph V betweenness estimate_betweenness
#' @describeIn centrality Wrapper for [igraph::betweenness()]
#' @importFrom igraph V betweenness
#' @importFrom rlang quos
#' @export
centrality_betweenness <- function(weights = NULL, directed = TRUE, cutoff = -1, normalized = FALSE) {
Expand All @@ -86,11 +86,9 @@ centrality_betweenness <- function(weights = NULL, directed = TRUE, cutoff = -1,
if (is.null(weights)) {
weights <- NA
}
if (is.null(cutoff)) {
betweenness(graph = graph, v = V(graph), directed = directed, weights = weights, normalized = normalized)
} else {
estimate_betweenness(graph = graph, vids = V(graph), directed = directed, cutoff = cutoff, weights = weights)
}
cutoff <- cutoff %||% -1
betweenness(graph = graph, v = V(graph), directed = directed, cutoff = cutoff, weights = weights, normalized = normalized)

}
#' @describeIn centrality Wrapper for [igraph::power_centrality()]
#' @importFrom igraph V power_centrality
Expand All @@ -100,8 +98,8 @@ centrality_power <- function(exponent = 1, rescale = FALSE, tol = 1e-7, loops =
graph <- .G()
power_centrality(graph = graph, nodes = V(graph), exponent = exponent, loops = loops, rescale = rescale, tol = tol)
}
#' @describeIn centrality Wrapper for [igraph::closeness()] and [igraph::estimate_closeness()]
#' @importFrom igraph V closeness estimate_closeness
#' @describeIn centrality Wrapper for [igraph::closeness()]
#' @importFrom igraph V closeness
#' @importFrom rlang quos
#' @export
centrality_closeness <- function(weights = NULL, mode = 'out', normalized = FALSE, cutoff = NULL) {
Expand All @@ -112,11 +110,8 @@ centrality_closeness <- function(weights = NULL, mode = 'out', normalized = FALS
if (is.null(weights)) {
weights <- NA
}
if (is.null(cutoff)) {
closeness(graph = graph, vids = V(graph), mode = mode, weights = weights, normalized = normalized)
} else {
estimate_closeness(graph = graph, vids = V(graph), mode = mode, cutoff = cutoff, weights = weights, normalized = normalized)
}
cutoff <- cutoff %||% -1
closeness(graph = graph, vids = V(graph), mode = mode, cutoff = cutoff, weights = weights, normalized = normalized)
}
#' @describeIn centrality Wrapper for [igraph::eigen_centrality()]
#' @importFrom igraph eigen_centrality
Expand Down Expand Up @@ -183,7 +178,7 @@ centrality_degree <- function(weights = NULL, mode = 'out', loops = TRUE, normal
}
}
#' @describeIn centrality Wrapper for [igraph::edge_betweenness()]
#' @importFrom igraph edge_betweenness estimate_edge_betweenness E
#' @importFrom igraph edge_betweenness E
#' @importFrom rlang quos
#' @export
centrality_edge_betweenness <- function(weights = NULL, directed = TRUE, cutoff = NULL) {
Expand All @@ -194,11 +189,9 @@ centrality_edge_betweenness <- function(weights = NULL, directed = TRUE, cutoff
if (is.null(weights)) {
weights <- NA
}
if (is.null(cutoff)) {
edge_betweenness(graph = graph, e = E(graph), directed = directed, weights = weights)
} else {
estimate_edge_betweenness(graph = graph, e = E(graph), directed = directed, cutoff = cutoff, weights = weights)
}

cutoff <- cutoff %||% -1
edge_betweenness(graph = graph, e = E(graph), directed = directed, cutoff = cutoff, weights = weights)
}
#' @describeIn centrality Manually specify your centrality score using the `netrankr` framework (`netrankr`)
#' @param relation The indirect relation measure type to be used in `netrankr::indirect_relations`
Expand Down
6 changes: 3 additions & 3 deletions man/centrality.Rd

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

2 changes: 1 addition & 1 deletion man/graph_measures.Rd

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