本文整理匯總了Python中graph.Vertex.weight方法的典型用法代碼示例。如果您正苦於以下問題:Python Vertex.weight方法的具體用法?Python Vertex.weight怎麽用?Python Vertex.weight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類graph.Vertex
的用法示例。
在下文中一共展示了Vertex.weight方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TestDagShortestPathsModified
# 需要導入模塊: from graph import Vertex [as 別名]
# 或者: from graph.Vertex import weight [as 別名]
def TestDagShortestPathsModified(self):
u = Vertex('u')
v = Vertex('v')
w = Vertex('w')
z = Vertex('z')
u.weight = 1
v.weight = 2
w.weight = 3
z.weight = 4
vertices = [u, v, w, z]
edges = [(u, v), (v, w), (v, z)]
G = Graph(vertices, edges)
self.assertEquals(dag_shortest_paths_modified(G, u), [u, v, z])