| GraphSpace-attributes | R Documentation |
Access and modify individual components of a GraphSpace object. Selected igraph methods are applied to the internal graph representation and propagated to downstream components.
## S4 method for signature 'GraphSpace'
gs_vertex_attr(x, name, ..., value)
## S4 replacement method for signature 'GraphSpace'
gs_vertex_attr(x, name, ...) <- value
## S4 method for signature 'GraphSpace'
gs_edge_attr(x, name, ..., value)
## S4 replacement method for signature 'GraphSpace'
gs_edge_attr(x, name, ...) <- value
x |
A GraphSpace class object |
name |
Name of the attribute. |
... |
Additional arguments passed to extraction methods. |
value |
Replacement value for the selected slot or attribute. |
library(RGraphSpace)
library(igraph)
# Load a demo igraph
data('gtoy1', package = 'RGraphSpace')
# Create a new GraphSpace object
gs <- GraphSpace(gtoy1)
#--- Usage of GraphSpace attribute accessors:
# Access all vertex attributes
gs_vertex_attr(gs)
# Access a specific vertex attribute
gs_vertex_attr(gs, "nodeLabel")
# Modify a single value within a vertex attribute
gs_vertex_attr(gs, "nodeSize")["n1"] <- 10
# Replace an entire vertex attribute
gs_vertex_attr(gs, "nodeSize") <- 10
# Add a new vertex attribute
gs_vertex_attr(gs, "node_var1") <- rnorm(gs_vcount(gs))
# Delete a vertex attribute
gs_vertex_attr(gs, "node_var1") <- NULL
# Access a specific edge attribute
gs_edge_attr(gs, "edgeColor")
# Replace an entire edge attribute
gs_edge_attr(gs, "edgeLineWidth") <- 1
# Add a new edge attribute
gs_edge_attr(gs, "edge_var1") <- rnorm(gs_ecount(gs))
# Delete an edge attribute
gs_edge_attr(gs, "edge_var1") <- NULL
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.