本文整理匯總了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))
示例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)