Skip to content

Commit

Permalink
refactor: early return() in graph_attr() (#1320)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviator-app[bot] authored Mar 25, 2024
2 parents aa0de48 + a2aad48 commit 104f77e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/attributes.R
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,12 @@ get.edge.attribute <- function(graph, name, index = E(graph)) { # nocov start
#' graph_attr(g, "name")
graph_attr <- function(graph, name) {
ensure_igraph(graph)

if (missing(name)) {
graph.attributes(graph)
} else {
.Call(R_igraph_mybracket2, graph, igraph_t_idx_attr, igraph_attr_idx_graph)[[as.character(name)]]
return(graph.attributes(graph))
}

.Call(R_igraph_mybracket2, graph, igraph_t_idx_attr, igraph_attr_idx_graph)[[as.character(name)]]
}


Expand Down

0 comments on commit 104f77e

Please sign in to comment.