コード例 #1
0
def load_ch_matrix():
    print "Reading NodeID map started at", time.strftime(time_format)
    start = time.time()
    node_id_map = inout.load_from_file(path +
                                       "{0}_node_id_map".format(dataset))
    print "Reading NodeID map took", time.time() - start, "s"
    print "-----------------------------------------"

    print "Reading hypergraph started at", time.strftime(time_format)
    start = time.time()
    hypergraph = Hypergraph.load_from_file(path + "{0}_hgraph".format(dataset))
    print "Reading hypergraph took", time.time() - start, "s"
    print "-----------------------------------------"

    print "Reading characteristic matrix started at", time.strftime(
        time_format)
    start = time.time()
    ch_matrix = CharacteristicMatrix.load_from_file(
        path + "{0}_ch_matrix".format(dataset))
    print "Reading characteristic matrix took", time.time() - start, "s"
    print "-----------------------------------------"

    print "Reading Column index to Node map started at", time.strftime(
        time_format)
    start = time.time()
    index_node_map = inout.load_from_file(path +
                                          "{0}_index_node_map".format(dataset))
    print "Reading Column index to Node map took", time.time() - start, "s"
    print "-----------------------------------------"

    return ch_matrix, hypergraph, index_node_map, node_id_map
コード例 #2
0
def load_ch_matrix():
    print "Reading NodeID map started at", time.strftime(time_format)
    start = time.time()
    node_id_map = inout.load_from_file(path + "{0}_node_id_map".format(dataset))
    print "Reading NodeID map took", time.time() - start, "s"
    print "-----------------------------------------"
    
    print "Reading hypergraph started at", time.strftime(time_format)
    start = time.time()
    hypergraph = Hypergraph.load_from_file(path + "{0}_hgraph".format(dataset))
    print "Reading hypergraph took", time.time() - start, "s"
    print "-----------------------------------------"
    
    print "Reading characteristic matrix started at", time.strftime(time_format)
    start = time.time()
    ch_matrix = CharacteristicMatrix.load_from_file(path + "{0}_ch_matrix".format(dataset))
    print "Reading characteristic matrix took", time.time() - start, "s"
    print "-----------------------------------------"
    
    print "Reading Column index to Node map started at", time.strftime(time_format)
    start = time.time()
    index_node_map = inout.load_from_file(path + "{0}_index_node_map".format(dataset))
    print "Reading Column index to Node map took", time.time() - start, "s"
    print "-----------------------------------------"
    
    return ch_matrix, hypergraph, index_node_map, node_id_map
コード例 #3
0
 def testHypergraph_ReadWrite(self):
     file_name = "test_files/dummy_hypergraph.tmp"
     dummy_hypergraph = Hypergraph(example_graphs.gt_dummy_graph)
     dummy_hypergraph.save_to_file(file_name)
     read_hypergraph = Hypergraph.load_from_file(file_name)
     self.assertEqual(
         dummy_hypergraph, read_hypergraph,
         "The read hypergraph is different from the saved one.")
コード例 #4
0
 def testHypergraph_ReadWrite(self):
     file_name = "test_files/dummy_hypergraph.tmp"
     dummy_hypergraph = Hypergraph(example_graphs.gt_dummy_graph)
     dummy_hypergraph.save_to_file(file_name)
     read_hypergraph = Hypergraph.load_from_file(file_name)
     self.assertEqual(dummy_hypergraph, read_hypergraph, "The read hypergraph is different from the saved one.")