Skip to content

Commit

Permalink
refactor: early return() in graph_attr()
Browse files Browse the repository at this point in the history
  • Loading branch information
maelle committed Mar 25, 2024
1 parent aa0de48 commit a2aad48
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 a2aad48

Please sign in to comment.