#NEWLINE# def testScalarStatistics( self ) : #NEWLINE# #INDENT# numFeatures = 1 #NEWLINE# numVertices = 10 #NEWLINE# vList = VertexList ( numVertices , numFeatures ) #NEWLINE# graph = SparseGraph ( vList ) #NEWLINE# graph . addEdge ( 0 , 1 ) #NEWLINE# growthStatistics = GraphStatistics ( ) #NEWLINE# statsArray = growthStatistics . scalarStatistics ( graph ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . numVerticesIndex ] == 10.0 ) ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . numEdgesIndex ] == 1.0 ) ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . maxComponentSizeIndex ] == 2.0 ) ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . maxComponentEdgesIndex ] == 1.0 ) ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . numComponentsIndex ] == 9.0 ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . meanComponentSizeIndex ] , ( 10.0 / 9.0 ) ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . meanDegreeIndex ] == 0.2 ) ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . diameterIndex ] == 1.0 ) ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . effectiveDiameterIndex ] == 1.0 ) ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . densityIndex ] == ( 1.0 / 45 ) ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . geodesicDistanceIndex ] , ( 1.0 / 55 ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . harmonicGeoDistanceIndex ] , 55.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . geodesicDistMaxCompIndex ] , ( 1.0 / 3 ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numNonSingletonComponentsIndex ] , 1.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numTriOrMoreComponentsIndex ] , 0.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . secondComponentSizeIndex ] , 1.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . maxCompMeanDegreeIndex ] , 1.0 ) #NEWLINE# graph . addEdge ( 0 , 2 ) #NEWLINE# graph . addEdge ( 3 , 4 ) #NEWLINE# graph . addEdge ( 3 , 5 ) #NEWLINE# graph . addEdge ( 3 , 6 ) #NEWLINE# graph . addEdge ( 7 , 8 ) #NEWLINE# statsArray = growthStatistics . scalarStatistics ( graph ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numNonSingletonComponentsIndex ] , 3.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numTriOrMoreComponentsIndex ] , 2.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . secondComponentSizeIndex ] , 3.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . maxCompMeanDegreeIndex ] , 1.5 ) #NEWLINE# graph = SparseGraph ( vList , False ) #NEWLINE# graph . addEdge ( 0 , 1 ) #NEWLINE# statsArray = growthStatistics . scalarStatistics ( graph , treeStats = True ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . numVerticesIndex ] == 10.0 ) ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . numEdgesIndex ] == 1.0 ) ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . maxComponentSizeIndex ] == ( - 1 ) ) ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . maxComponentEdgesIndex ] == ( - 1 ) ) ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . numComponentsIndex ] == ( - 1 ) ) ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . meanComponentSizeIndex ] == ( - 1 ) ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . meanDegreeIndex ] , 0.1 ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . diameterIndex ] == 1.0 ) ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . effectiveDiameterIndex ] == 1.0 ) ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . densityIndex ] == ( 1.0 / 90 ) ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . geodesicDistanceIndex ] , ( 1.0 / 100 ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . harmonicGeoDistanceIndex ] , 100 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . meanTreeSizeIndex ] , ( 10.0 / 9 ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . meanTreeDepthIndex ] , ( 1.0 / 9 ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . maxTreeSizeIndex ] , 2.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . maxTreeDepthIndex ] , 1.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numTreesIndex ] , 9.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numNonSingletonTreesIndex ] , 1.0 ) #NEWLINE# graph . addEdge ( 2 , 3 ) #NEWLINE# graph . addEdge ( 2 , 4 ) #NEWLINE# graph . addEdge ( 3 , 5 ) #NEWLINE# graph . addEdge ( 3 , 6 ) #NEWLINE# statsArray = growthStatistics . scalarStatistics ( graph , treeStats = True ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . maxTreeSizeIndex ] , 5.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . maxTreeDepthIndex ] , 2.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . secondTreeSizeIndex ] , 2.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . secondTreeDepthIndex ] , 1.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numTreesIndex ] , 5.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numNonSingletonTreesIndex ] , 2.0 ) #NEWLINE# numFeatures = 0 #NEWLINE# numVertices = 0 #NEWLINE# vList = VertexList ( numVertices , numFeatures ) #NEWLINE# graph = SparseGraph ( vList ) #NEWLINE# statsArray = growthStatistics . scalarStatistics ( graph ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numVerticesIndex ] , 0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numEdgesIndex ] , 0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . maxComponentSizeIndex ] , 0 ) #NEWLINE# self . assertTrue ( ( statsArray [ growthStatistics . maxComponentEdgesIndex ] == 0 ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numComponentsIndex ] , 0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . meanComponentSizeIndex ] , 0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . meanDegreeIndex ] , 0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . diameterIndex ] , 0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . effectiveDiameterIndex ] , 0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . densityIndex ] , 0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . geodesicDistanceIndex ] , 0.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . harmonicGeoDistanceIndex ] , 0.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . geodesicDistMaxCompIndex ] , 0.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numNonSingletonComponentsIndex ] , 0.0 ) #NEWLINE# graph = SparseGraph ( vList , False ) #NEWLINE# statsArray = growthStatistics . scalarStatistics ( graph ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numVerticesIndex ] , 0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numEdgesIndex ] , 0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . maxComponentSizeIndex ] , ( - 1 ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numComponentsIndex ] , ( - 1 ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . meanComponentSizeIndex ] , ( - 1 ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . maxComponentEdgesIndex ] , ( - 1 ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . meanDegreeIndex ] , 0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . diameterIndex ] , 0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . effectiveDiameterIndex ] , 0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . densityIndex ] , 0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . geodesicDistanceIndex ] , 0.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . harmonicGeoDistanceIndex ] , 0.0 ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . geodesicDistMaxCompIndex ] , ( - 1 ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . meanTreeSizeIndex ] , ( - 1 ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . meanTreeDepthIndex ] , ( - 1 ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numNonSingletonComponentsIndex ] , ( - 1 ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numTreesIndex ] , ( - 1 ) ) #NEWLINE# self . assertEquals ( statsArray [ growthStatistics . numNonSingletonTreesIndex ] , ( - 1 ) )