【发布时间】:2020-08-15 13:01:38
【问题描述】:
我无法更改igraph 中图形对象中特定顶点的属性。
from igraph import *
G = Graph()
G.add_vertices(2)
G.vs['names'] = [(1, 1), (10, 10)]
# change the name
G.vs['names'][0] = (5, 5)
print G.vs['names'][0]
(1, 1)
我尝试将元组更改为列表,但没有成功
G = Graph()
G.add_vertices(2)
G.vs['names'] = [ [1, 1], [10, 10] ]
G.vs['names'][0] = [5, 5]
print G.vs['names'][0]
[1, 1]
我也尝试使用G.vs['position'][0].pop(),但它也不起作用。知道如何更改 igraph 中的属性吗?
【问题讨论】:
标签: python-3.x igraph