當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。