GraphSpace-accessors: Accessors for applying essential igraph methods to modify...

names,GraphSpace-methodR Documentation

Accessors for applying essential igraph methods to modify attributes of GraphSpace objects.

Description

Access and modify individual slots of a GraphSpace object. Selected 'igraph' methods are applied to the 'graph' slot and propagated to downstream components.

Usage

## S4 method for signature 'GraphSpace'
names(x)

## S4 replacement method for signature 'GraphSpace'
names(x) <- value

## S4 method for signature 'GraphSpace'
gs_vcount(x)

## S4 method for signature 'GraphSpace'
gs_ecount(x)

## S4 method for signature 'GraphSpace'
gs_vertex_attr(x, name, ...)

## S4 replacement method for signature 'GraphSpace'
gs_vertex_attr(x, name, ...) <- value

## S4 method for signature 'GraphSpace'
gs_edge_attr(x, name, ...)

## S4 replacement method for signature 'GraphSpace'
gs_edge_attr(x, name, ...) <- value

Arguments

x

A GraphSpace class object

value

The new value of the attribute.

name

Name of the attribute.

...

Additional arguments passed to igraph methods.

Value

Updated GraphSpace object.

See Also

vertex_attr, edge_attr

Examples

# Load a demo igraph
data('gtoy1', package = 'RGraphSpace')

# Create a new GraphSpace object
gs <- GraphSpace(gtoy1)

# Usage of GraphSpace attribute accessors:

# Get vertex names
names(gs)

# Get vertex count
gs_vcount(gs)

# Get edge count
gs_ecount(gs)

# 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

# Alternative syntax using `$` accessor
gs_vertex_attr(gs)$nodeSize <- 10

# Access a specific edge attribute
gs_edge_attr(gs, "edgeLineColor")

# Replace an entire edge attribute
gs_edge_attr(gs, "edgeLineWidth") <- 1

 # Alternative syntax using `$` for edge attributes
gs_edge_attr(gs)$edgeLineWidth <- 3


RGraphSpace documentation built on Aug. 8, 2025, 7:15 p.m.