This retrieves a single attribute for an individual vertex.

get_vertex_attribute(g, name, vertex)

Arguments

g

A nctx graph

name

Name of the attribute

vertex

ID of the vertex of interest

Value

The attribute value for the vertex

See also

Examples

library(RUnit) library(nctx) file <- system.file("extdata", "bcde.ctx.dir.graphml", package="nctx") g <- load_graph(file, directed = TRUE) checkEquals(get_vertex_attributes(g, "distance_to_A"), c(0.0000000,0.2938160,1.0000000,0.4637440,0.3066590,0.1263650,0.3882870,0.0927837,0.2409850,0.5995490))
#> [1] TRUE
checkEquals(get_vertex_attribute(g, "distance_to_A", 3), 1.0)
#> [1] TRUE