双中括号运算符可用于顶点序列,以打印序列中顶点的元数据(顶点属性)。
详细信息
从技术上讲,与顶点序列一起使用时,双中括号运算符与单中括号运算符的作用完全相同,但是生成的顶点序列的打印方式有所不同:序列中所有顶点的属性也将被打印。
有关索引顶点序列的更多信息,请参见 [.igraph.vs
。
参见
其他顶点和边序列:E()
、V()
、as_ids()
、igraph-es-attributes
、igraph-es-indexing
、igraph-es-indexing2
、igraph-vs-attributes
、igraph-vs-indexing
、print.igraph.es()
、print.igraph.vs()
其他顶点和边序列操作:c.igraph.es()
、c.igraph.vs()
、difference.igraph.es()
、difference.igraph.vs()
、igraph-es-indexing
、igraph-es-indexing2
、igraph-vs-indexing
、intersection.igraph.es()
、intersection.igraph.vs()
、rev.igraph.es()
、rev.igraph.vs()
、union.igraph.es()
、union.igraph.vs()
、unique.igraph.es()
、unique.igraph.vs()
示例
g <- make_ring(10) %>%
set_vertex_attr("color", value = "red") %>%
set_vertex_attr("name", value = LETTERS[1:10])
V(g)
#> + 10/10 vertices, named, from fc05312:
#> [1] A B C D E F G H I J
V(g)[[]]
#> + 10/10 vertices, named, from fc05312:
#> color name
#> 1 red A
#> 2 red B
#> 3 red C
#> 4 red D
#> 5 red E
#> 6 red F
#> 7 red G
#> 8 red H
#> 9 red I
#> 10 red J
V(g)[1:5]
#> + 5/10 vertices, named, from fc05312:
#> [1] A B C D E
V(g)[[1:5]]
#> + 5/10 vertices, named, from fc05312:
#> color name
#> 1 red A
#> 2 red B
#> 3 red C
#> 4 red D
#> 5 red E