当前位置: 首页>>代码示例>>Python>>正文


Python HIVGraph.isUndirected方法代码示例

本文整理汇总了Python中exp.viroscopy.model.HIVGraph.HIVGraph.isUndirected方法的典型用法代码示例。如果您正苦于以下问题:Python HIVGraph.isUndirected方法的具体用法?Python HIVGraph.isUndirected怎么用?Python HIVGraph.isUndirected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在exp.viroscopy.model.HIVGraph.HIVGraph的用法示例。


在下文中一共展示了HIVGraph.isUndirected方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testPickle

# 需要导入模块: from exp.viroscopy.model.HIVGraph import HIVGraph [as 别名]
# 或者: from exp.viroscopy.model.HIVGraph.HIVGraph import isUndirected [as 别名]
 def testPickle(self): 
     numVertices = 10
     graph = HIVGraph(numVertices)  
     graph[0, 0] = 1
     graph[3, 5] = 0.1
     
     output = pickle.dumps(graph)
     newGraph = pickle.loads(output)
     
     graph[2, 2] = 1
     
     self.assertEquals(newGraph[0, 0], 1)
     self.assertEquals(newGraph[3, 5], 0.1)
     self.assertEquals(newGraph[2, 2], 0.0)
     self.assertEquals(newGraph.getNumEdges(), 2)
     self.assertEquals(newGraph.getNumVertices(), numVertices)
     self.assertEquals(newGraph.isUndirected(), True)
     
     self.assertEquals(graph[0, 0], 1)
     self.assertEquals(graph[3, 5], 0.1)
     self.assertEquals(graph[2, 2], 1)
     self.assertEquals(graph.getNumEdges(), 3)
     self.assertEquals(graph.getNumVertices(), numVertices)
     self.assertEquals(graph.isUndirected(), True)        
     
     for i in range(numVertices): 
         nptst.assert_array_equal(graph.getVertex(i), newGraph.getVertex(i))
开发者ID:charanpald,项目名称:wallhack,代码行数:29,代码来源:HIVGraphTest.py

示例2: testContructor

# 需要导入模块: from exp.viroscopy.model.HIVGraph import HIVGraph [as 别名]
# 或者: from exp.viroscopy.model.HIVGraph.HIVGraph import isUndirected [as 别名]
    def testContructor(self):
        numVertices = 10
        graph = HIVGraph(numVertices)

        
        self.assertEquals(numVertices, graph.getNumVertices())
        self.assertEquals(8, graph.getVertexList().getNumFeatures())
        self.assertTrue(graph.isUndirected() == True)
开发者ID:charanpald,项目名称:wallhack,代码行数:10,代码来源:HIVGraphTest.py


注:本文中的exp.viroscopy.model.HIVGraph.HIVGraph.isUndirected方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。