-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
fix: use V(graph) as we should #1433
base: main
Are you sure you want to change the base?
Conversation
Current Aviator status
This pull request is currently open (not queued). How to mergeTo merge this PR, comment
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.
|
@@ -520,7 +520,7 @@ vertex.attributes <- function(graph, index = V(graph)) { | |||
|
|||
if (!missing(index)) { | |||
index_is_natural_sequence <- (length(index) == vcount(graph) && | |||
identical(index, seq(1, vcount(graph)))) | |||
identical(index, V(graph))) |
There was a problem hiding this comment.
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
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).
There was a problem hiding this comment.
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))
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Fix #1432
Fix #1427
cc @krlmlr @clpippel