示例#1
0
 def choose_node_with_higher_cardinality(self, nodes, cutoff):
     return choose_node_with_higher_cardinality(self, nodes, cutoff)
     numpy.testing.assert_array_equal(neighbors1,neighbors3)
     print "OK"
 except Exception,message:
     print message
     print "KO"
 
 print "================================================"
 print "'choose_node_with_higher_cardinality' benchmark"
 print "================================================"
 time_start = time.time()
 neighbors1 = matrix.choose_node_with_higher_cardinality(remaining_nodes, 0.5)
 time_end = time.time()
 print "Fast Neighbor cardinality for Fast matrix took %.3fs"%(time_end-time_start)
 
 time_start = time.time()
 neighbors2 = matrix2.choose_node_with_higher_cardinality(remaining_nodes, 0.5)
 time_end = time.time()
 print "Slow Neighbor cardinality for Slow matrix took %.3fs"%(time_end-time_start)
 
 time_start = time.time()
 neighbors3 = choose_node_with_higher_cardinality(matrix,remaining_nodes, 0.5)
 time_end = time.time()
 print "Slow Neighbor cardinality for Fast matrix took %.3fs"%(time_end-time_start)
 
 print "================================================"
 print "'choose_node_with_higher_cardinality' validation"
 print "================================================"
 if(neighbors1 == neighbors2 and neighbors2 == neighbors3):
     print "OK"
 else:
     print "KO"
    print("'choose_node_with_higher_cardinality' benchmark")
    print("================================================")
    time_start = time.time()
    neighbors1 = matrix.choose_node_with_higher_cardinality(
        remaining_nodes, 0.5)
    time_end = time.time()
    print("Fast Neighbor cardinality for Fast matrix took %.3fs" %
          (time_end - time_start))

    time_start = time.time()
    neighbors2 = matrix2.choose_node_with_higher_cardinality(
        remaining_nodes, 0.5)
    time_end = time.time()
    print("Slow Neighbor cardinality for Slow matrix took %.3fs" %
          (time_end - time_start))

    time_start = time.time()
    neighbors3 = choose_node_with_higher_cardinality(matrix, remaining_nodes,
                                                     0.5)
    time_end = time.time()
    print("Slow Neighbor cardinality for Fast matrix took %.3fs" %
          (time_end - time_start))

    print("================================================")
    print("'choose_node_with_higher_cardinality' validation")
    print("================================================")
    if (neighbors1 == neighbors2 and neighbors2 == neighbors3):
        print("OK")
    else:
        print("KO")
 def choose_node_with_higher_cardinality(self,nodes,cutoff):
     return choose_node_with_higher_cardinality(self,nodes,cutoff)