DiagrammeR (version 0.9.0)

delete_global_graph_attrs: Delete one of the global graph attributes stored within a graph object

Description

Delete one of the global attributes stored within a graph object of class dgr_graph).

Usage

delete_global_graph_attrs(graph, attr, attr_type)

Arguments

graph

a graph object of class dgr_graph.

attr

the name of the attribute to delete for the type of global attribute specified.

attr_type

the specific type of global graph attribute to delete. The type is specified with graph, node, or edge.

Value

a graph object of class dgr_graph.

Examples

Run this code
# NOT RUN {
# Create a new graph and add some global attributes
graph <-
  create_graph() %>%
  add_global_graph_attrs(
    "overlap", "true", "graph") %>%
  add_global_graph_attrs(
    "penwidth", 3, "node") %>%
  add_global_graph_attrs(
    "penwidth", 3, "edge")

# View the graph's global attributes
get_global_graph_attrs(graph)
#>       attr value attr_type
#> 1  overlap  true     graph
#> 2 penwidth     3      node
#> 3 penwidth     3      edge

# Delete the `penwidth` attribute for the graph's
# nodes using `delete_global_graph_attrs()`
graph <-
  graph %>%
  delete_global_graph_attrs("penwidth", "node")

# View the remaining set of global
# attributes for the graph
get_global_graph_attrs(graph)
#>       attr value attr_type
#> 1 penwidth     3      edge
#> 2  overlap  true     graph
# }

Run the code above in your browser using DataCamp Workspace