Skip to contents

Set all or some graph attributes

Usage

graph_attr(graph, name) <- value

Arguments

graph

The graph.

name

The name of the attribute to set. If missing, then value should be a named list, and all list members are set as attributes.

value

The value of the attribute to set

Value

The graph, with the attribute(s) added.

Examples

g <- make_graph(~ A - B:C:D)
graph_attr(g, "name") <- "4-star"
g
#> IGRAPH 60d8566 UN-- 4 3 -- 4-star
#> + attr: name (g/c), name (v/c)
#> + edges from 60d8566 (vertex names):
#> [1] A--B A--C A--D

graph_attr(g) <- list(
  layout = layout_with_fr(g),
  name = "4-star layed out"
)
plot(g)