Skip to content

Commit

Permalink
refactor: explaining variables (#1326)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviator-app[bot] committed Apr 8, 2024
2 parents b5c3a81 + dad6e67 commit 4f1c0ef
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions R/attributes.R
Expand Up @@ -517,12 +517,15 @@ vertex.attributes <- function(graph, index = V(graph)) {

res <- .Call(R_igraph_mybracket2_copy, graph, igraph_t_idx_attr, igraph_attr_idx_vertex)

if (!missing(index) &&
(length(index) != vcount(graph) || any(index != V(graph)))) {
for (i in seq_along(res)) {
res[[i]] <- res[[i]][index]
if (!missing(index)) {
index_is_natural_sequence <- (length(index) == vcount(graph) && all(index == V(graph)))
if (!index_is_natural_sequence) {
for (i in seq_along(res)) {
res[[i]] <- res[[i]][index]
}
}
}

res
}

Expand Down

0 comments on commit 4f1c0ef

Please sign in to comment.