Skip to content

Conversation

@maelle
Copy link
Contributor

@maelle maelle commented Jul 17, 2024

@maelle maelle requested a review from szhorvat July 17, 2024 12:14
@aviator-app
Copy link
Contributor

aviator-app bot commented Jul 17, 2024

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

This PR is currently in state closed (PR closed manually).


See the real-time status of this PR on the Aviator webapp.
Use the Aviator Chrome Extension to see the status of your PR within GitHub.

if (!missing(index)) {
index_is_natural_sequence <- (length(index) == vcount(graph) &&
identical(index, seq(1, vcount(graph))))
identical(index, V(graph)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think this should be

Suggested change
identical(index, V(graph)))
identical(index, as.numeric(seq_len(vcount(graph)))))

We want to cater for cases where !missing(index) but index is still essentially V(g) . I see:

library(igraph)
g <- make_ring(10)

identical(V(g), V(g))
#> [1] FALSE

Created on 2024-07-18 with reprex v2.1.0

Similarly to #1432 (comment).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

graph <- make_ring(5)
index <- V(graph)
identical(index, as.numeric(seq_len(vcount(graph))))
# returns FALSE.

Try all(index == V(graph))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@clpippel: all() is challenging if the vectors are of different length? We'd still want to check the lengths first.

Would the all() route be faster?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we also want to check isTRUE(attr(g, "is_all")) ?

options(conflicts.policy = list(warn = FALSE))

library(igraph)
g <- make_ring(10)
dput(V(g))
#> structure(1:10, class = "igraph.vs", is_all = TRUE, env = <weak reference>, graph = "516d6a01-f041-48ae-bbe3-60dd751a8f4b")

Created on 2024-08-22 with reprex v2.1.0

Need to check if this other code path is ever touched -- easiest way by breaking it and running tests or revdeps.

@krlmlr
Copy link
Contributor

krlmlr commented Apr 10, 2025

Continuing in #1427.

@krlmlr krlmlr closed this Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

V(g) not the same as 1:vcount Use as.numeric(seq_len(n)) in favor of seq(1, n)

3 participants