Skip to content

Commit

Permalink
fix: Avoid duplicate objects (#1223)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviator-app[bot] authored Feb 8, 2024
2 parents 96e8334 + 27fdab3 commit e98211d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 25 deletions.
3 changes: 2 additions & 1 deletion R/aaa-auto.R
Original file line number Diff line number Diff line change
Expand Up @@ -1880,7 +1880,8 @@ pseudo_diameter_impl <- function(graph, start.vid, directed=TRUE, unconnected=TR
res
}

pseudo_diameter_impl <- function(graph, weights=NULL, start.vid, directed=TRUE, unconnected=TRUE) {
# https://github.com/igraph/igraph/commit/d455f61f4832d5207cb0a0475fb5ddc02409ae76#r138442064
pseudo_diameter_dijkstra_impl <- function(graph, weights=NULL, start.vid, directed=TRUE, unconnected=TRUE) {
# Argument checks
ensure_igraph(graph)
if (is.null(weights) && "weight" %in% edge_attr_names(graph)) {
Expand Down
14 changes: 0 additions & 14 deletions R/components.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,6 @@ articulation.points <- function(graph) { # nocov start
# Connected components, subgraphs, kinda
###################################################################

#' @family components
#' @export
count_components <- function(graph, mode = c("weak", "strong")) {
ensure_igraph(graph)
mode <- igraph.match.arg(mode)
mode <- switch(mode,
"weak" = 1L,
"strong" = 2L
)

on.exit(.Call(R_igraph_finalizer))
.Call(R_igraph_no_components, graph, mode)
}

#' @rdname components
#' @param cumulative Logical, if TRUE the cumulative distirubution (relative
#' frequency) is calculated.
Expand Down
9 changes: 0 additions & 9 deletions R/lazyeval.R
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,7 @@ print.lazy <- function(x, ...) {
cat(" expr: ", code, "\n", sep = "")
cat(" env: ", format(x$env), "\n", sep = "")
}
make_call <- function(fun, args) {
stopifnot(is.call(fun) || is.name(fun))
args <- as.lazy_dots(args)
expr <- lapply(args, `[[`, "expr")

lazy_(
as.call(c(fun, expr)),
common_env(args)
)
}
common_env <- function(dots) {
if (!is.list(dots)) stop("dots must be a list", call. = FALSE)
if (length(dots) == 0) {
Expand Down
13 changes: 12 additions & 1 deletion R/structural.properties.R
Original file line number Diff line number Diff line change
Expand Up @@ -2411,7 +2411,18 @@ components <- function(graph, mode = c("weak", "strong")) {
is_connected <- is_connected_impl

#' @rdname components
count_components <- count_components
#' @export
count_components <- function(graph, mode = c("weak", "strong")) {
ensure_igraph(graph)
mode <- igraph.match.arg(mode)
mode <- switch(mode,
"weak" = 1L,
"strong" = 2L
)

on.exit(.Call(R_igraph_finalizer))
.Call(R_igraph_no_components, graph, mode)
}

#' Convert a general graph into a forest
#'
Expand Down

0 comments on commit e98211d

Please sign in to comment.