#NEWLINE# def testGenerateGraph( self ) : #NEWLINE# #INDENT# k = 2 #NEWLINE# numVertices = 3 #NEWLINE# numFeatures = 0 #NEWLINE# vList = VertexList ( numVertices , numFeatures ) #NEWLINE# initialGraph = SparseGraph ( vList ) #NEWLINE# initialGraph . addEdge ( 0 , 1 ) #NEWLINE# initialGraph . addEdge ( 1 , 2 ) #NEWLINE# for i in range ( numVertices ) : #NEWLINE# #INDENT# initialGraph . addEdge ( i , i ) #NEWLINE# #UNINDENT# d = initialGraph . diameter ( ) #NEWLINE# degreeSequence = initialGraph . outDegreeSequence ( ) #NEWLINE# generator = StochasticKroneckerGenerator ( initialGraph , k ) #NEWLINE# graph = generator . generateGraph ( ) #NEWLINE# d2 = graph . diameter ( ) #NEWLINE# degreeSequence2 = graph . outDegreeSequence ( ) #NEWLINE# self . assertTrue ( ( numpy . kron ( degreeSequence , degreeSequence ) == degreeSequence2 ) . all ( ) ) #NEWLINE# self . assertTrue ( ( graph . getNumVertices ( ) == ( numVertices ** k ) ) ) #NEWLINE# self . assertTrue ( ( graph . getNumDirEdges ( ) == ( initialGraph . getNumDirEdges ( ) ** k ) ) ) #NEWLINE# self . assertEquals ( initialGraph , d2 ) #NEWLINE# k = 3 #NEWLINE# generator . setK ( k ) #NEWLINE# graph = generator . generateGraph ( ) #NEWLINE# d3 = graph . diameter ( ) #NEWLINE# degreeSequence3 = graph . outDegreeSequence ( ) #NEWLINE# self . assertTrue ( ( numpy . kron ( degreeSequence , degreeSequence2 ) == degreeSequence3 ) . all ( ) ) #NEWLINE# self . assertTrue ( ( graph . getNumVertices ( ) == ( numVertices ** k ) ) ) #NEWLINE# self . assertTrue ( ( graph . getNumDirEdges ( ) == ( initialGraph . getNumDirEdges ( ) ** k ) ) ) #NEWLINE# self . assertEquals ( d , d3 ) #NEWLINE# logging . debug ( degreeSequence ) #NEWLINE# logging . debug ( degreeSequence2 ) #NEWLINE# logging . debug ( degreeSequence3 )