本文整理汇总了Python中apgl.graph.SparseGraph.SparseGraph.concat方法的典型用法代码示例。如果您正苦于以下问题:Python SparseGraph.concat方法的具体用法?Python SparseGraph.concat怎么用?Python SparseGraph.concat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类apgl.graph.SparseGraph.SparseGraph
的用法示例。
在下文中一共展示了SparseGraph.concat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testConcat
# 需要导入模块: from apgl.graph.SparseGraph import SparseGraph [as 别名]
# 或者: from apgl.graph.SparseGraph.SparseGraph import concat [as 别名]
def testConcat(self):
numVertices = 5
graph = SparseGraph(GeneralVertexList(numVertices))
graph.addEdge(1, 1, 0.1)
graph.addEdge(1, 3, 0.5)
graph.addEdge(2, 4, 1)
graph.addEdge(2, 3, 2)
graph.setVertex(0, "abc")
graph2 = SparseGraph(GeneralVertexList(numVertices))
graph2.addEdge(1, 1)
graph2.addEdge(1, 4)
graph2.setVertex(1, "def")
graph3 = graph.concat(graph2)
self.assertTrue(graph3.getNumVertices, 10)
self.assertEquals(graph3.getVertex(0), "abc")
self.assertEquals(graph3.getVertex(6), "def")
self.assertEquals(graph3.getEdge(1, 1), 0.1)
self.assertEquals(graph3.getEdge(1, 3), 0.5)
self.assertEquals(graph3.getEdge(2, 4), 1)
self.assertEquals(graph3.getEdge(2, 3), 2)
self.assertEquals(graph3.getEdge(6, 6), 1)
self.assertEquals(graph3.getEdge(6, 9), 1)