如何转换“顶点序列"列表?到矢量 [英] how to convert list of "vertex sequence" to a vector

查看:88
本文介绍了如何转换“顶点序列"列表?到矢量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在R中使用Igraph包,当我通过V(graph)访问顶点名称列表时,得到以下结果:

I am using Igraph package in R and when I am accessing the list of vertices names through V(graph), I am getting the following result:

Vertex sequence:
 [1] "d66cp96igcdnt25brjeics9d11" "bovlonq25tmuaiak6do92v9cj0" "simj1u4714pa07p38vhstusf36" "6t6tnkoh4ftbgt787pvpmp1323"
 [5] "mf987tcmm8u8j3pdo4cts6jml3"

我需要这些名称的向量的问题,但这是structure(1:20, class = "igraph.vs", env = <environment>)

The problem that I need a vectors of these names, but this is structure(1:20, class = "igraph.vs", env = <environment>)

我的想法用as.vector()进行转换,因为as.factor没有产生结果. 有没有办法将其转换为字符串向量?

my ideas to transform it with as.vector(), as.factor did not yield a result. Is there a way how to convert it to a vector of strings?

推荐答案

.... 好的,我找到了出路:

.... Ok, I found a way out:

V(graph)$name给我一个名字的载体

这篇关于如何转换“顶点序列"列表?到矢量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆