本文整理汇总了Python中igraph.Graph.vs["l"]方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.vs["l"]方法的具体用法?Python Graph.vs["l"]怎么用?Python Graph.vs["l"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类igraph.Graph
的用法示例。
在下文中一共展示了Graph.vs["l"]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createTestGraph
# 需要导入模块: from igraph import Graph [as 别名]
# 或者: from igraph.Graph import vs["l"] [as 别名]
def createTestGraph():
''' Test code. Creates a graph to test on'''
#g = Graph([(0,1), (0,2), (2,3), (3,4), (4,2), (2,5), (5,0), (6,3), (5,6)]) #Test graph
g = Graph([(0,1),(1,2),(0,2),(2,3),(3,4),(4,5),(3,5),(5,6),(3,6),(6,7),(2,7),(7,8),(8,9),(9,10),(8,10),(6,8)])
# Create vertex labels
vertex_lables = ["A", "B", "B", "B", "A", "B", "B", "C", "A", "B", "B"]
# Create edge labels
#edge_labels = ["a", "a", "a", "a", "b", "b", "b", "c", "d"]
edge_labels = ["a"]
g.vs["l"] = vertex_lables
g.es["l"] = edge_labels
'''
g = Graph([(0,1), (1,2), (2,0), (2,3)])
g.vs["nl"] = ["A", "B", "C", "D"]
g.es["nl"] = ["e"]
'''
return g