Skip to content

Commit ce32250

Browse files
committed
Iterators created with E(P = ...) or E(path = ...) are incomplete
1 parent 9c50fe6 commit ce32250

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

R/iterators.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ E <- function(graph, P = NULL, path = NULL, directed = TRUE) {
317317
if (is.null(P) && is.null(path)) {
318318
ec <- ecount(graph)
319319
res <- seq_len(ec)
320+
res <- set_complete_iterator(res)
320321
} else if (!is.null(P)) {
321322
on.exit(.Call(C_R_igraph_finalizer))
322323
res <- .Call(
@@ -340,7 +341,6 @@ E <- function(graph, P = NULL, path = NULL, directed = TRUE) {
340341
}
341342

342343
class(res) <- "igraph.es"
343-
res <- set_complete_iterator(res)
344344
add_vses_graph_ref(res, graph)
345345
}
346346

tests/testthat/test-iterators.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ test_that("V(g) returns complete iterator, completeness is lost with next subset
9393
})
9494

9595
test_that("E(g) returns complete iterator, completeness is lost with next subsetting", {
96-
g <- make_star(4)
96+
g <- make_full_graph(4)
9797
iter <- E(g)
9898
expect_true(is_complete_iterator(iter))
9999
expect_false(is_complete_iterator(iter[1]))
100100
expect_false(is_complete_iterator(iter[1:3]))
101+
expect_false(is_complete_iterator(E(g, P = 1:4)))
102+
expect_false(is_complete_iterator(E(g, path = 1:4)))
101103
})

0 commit comments

Comments
 (0)