def testInit(self):
        numVertices = 0
        numFeatures = 1
        vList = VertexList(numVertices, numFeatures)

        graph = CsArrayGraph(vList)
        self.assertEquals(graph.weightMatrixDType(), numpy.float)

        graph = CsArrayGraph(vList, dtype=numpy.int16)
        self.assertEquals(graph.weightMatrixDType(), numpy.int16)
        
        #Test just specifying number of vertices 
        graph = CsArrayGraph(numVertices)
        self.assertEquals(graph.size, numVertices)
Beispiel #2
0
    def testInit(self):
        numVertices = 0
        numFeatures = 1
        vList = VertexList(numVertices, numFeatures)

        graph = CsArrayGraph(vList)
        self.assertEquals(graph.weightMatrixDType(), numpy.float)

        graph = CsArrayGraph(vList, dtype=numpy.int16)
        self.assertEquals(graph.weightMatrixDType(), numpy.int16)

        #Test just specifying number of vertices
        graph = CsArrayGraph(numVertices)
        self.assertEquals(graph.size, numVertices)
Beispiel #3
0
    def testAddVertices(self):
        graph = CsArrayGraph(10)
        graph[3, 4] = 1

        graph.addVertices(5)

        self.assertEquals(graph[3, 4], 1)
        self.assertEquals(graph.getNumEdges(), 1)
        self.assertEquals(graph.size, 15)

        graph[10, 11] = 0.1
        graph.addVertices(5)

        self.assertEquals(graph[3, 4], 1)
        self.assertEquals(graph[10, 11], 0.1)
        self.assertEquals(graph.getNumEdges(), 2)
        self.assertEquals(graph.size, 20)
 def testAddVertices(self): 
     graph = CsArrayGraph(10)
     graph[3, 4] = 1
     
     graph.addVertices(5)
     
     self.assertEquals(graph[3,4], 1)
     self.assertEquals(graph.getNumEdges(), 1)
     self.assertEquals(graph.size, 15)
     
     graph[10, 11] = 0.1
     graph.addVertices(5)
     
     self.assertEquals(graph[3,4], 1)
     self.assertEquals(graph[10,11], 0.1)
     self.assertEquals(graph.getNumEdges(), 2)
     self.assertEquals(graph.size, 20)