vertex_attr: Query vertex attributes of a graph

Description Usage Arguments Value See Also Examples

View source: R/attributes.R

Description

Query vertex attributes of a graph

Usage

1

Arguments

graph

The graph.

name

Name of the attribute to query. If missing, then all vertex attributes are returned in a list.

index

A vertex sequence, to query the attribute only for these vertices.

Value

The value of the vertex attribute, or the list of all vertex attributes, if name is missing.

See Also

Other graph attributes: delete_edge_attr(), delete_graph_attr(), delete_vertex_attr(), edge_attr<-(), edge_attr_names(), edge_attr(), graph_attr<-(), graph_attr_names(), graph_attr(), igraph-dollar, igraph-vs-attributes, set_edge_attr(), set_graph_attr(), set_vertex_attr(), vertex_attr<-(), vertex_attr_names()

Examples

1
2
3
4
5
6
g <- make_ring(10) %>%
  set_vertex_attr("color", value = "red") %>%
  set_vertex_attr("label", value = letters[1:10])
vertex_attr(g, "label")
vertex_attr(g)
plot(g)

Example output

Attaching package: 'igraph'

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union

 [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j"
$color
 [1] "red" "red" "red" "red" "red" "red" "red" "red" "red" "red"

$label
 [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j"

igraph documentation built on Jan. 8, 2021, 2:19 a.m.

Related to vertex_attr in igraph...