Esempio n. 1
0
int main(int argc, char **argv){
    if((argc != 2) || (strcmp(argv[1],"-h") == 0) || (strcmp(argv[1],"--help") == 0) ){
        usage(argv[0]);
    }

    Graph::VertexWeightedGraph *G;

    Graph::GraphCreatorFile creator;
    creator.set_file_name(argv[1]);
    creator.set_graph_type("DIMACS");
    G = creator.create_weighted_mutable_graph();
    G->complement();
    Graph::GraphWriter writer;

    char comp_DIMACS_file[200];
    char normalized_comp_DIMACS_file[200];
    sprintf(comp_DIMACS_file,"%s.comp",argv[1]);
    writer.write_graph(G,comp_DIMACS_file,"DIMACS",true,false);
    // Now normalize it
    sprintf(normalized_comp_DIMACS_file,"%s.norm",comp_DIMACS_file);
    normalize_DIMACS_file(comp_DIMACS_file,normalized_comp_DIMACS_file);
    fprintf(stderr,"Complement graph of %s written to %s in normalized DIMACS form\n",
            argv[1],normalized_comp_DIMACS_file);

    delete G;
    return 1;
} // main
Esempio n. 2
0
void parmetis_with_metmmd(){
    DEBUG("########## Testing Function : %s #################\n", __FUNCTION__);
    int size, rank;
    MPI_Comm comm;
    Graph::GraphEOUtil eoutil;
    Graph::VertexWeightedGraph *wmg;
    Graph::GraphCreatorFile creator;

    int output[] =
    {
        102,58,128,121,86,64,96,112,103,117,120,87,124,126,127,63,95,108,110,111,91,107,109,119,123,125,115,59,61,62,90,93,122,114,106,118,32,116,55,100,16,79,84,78,24,48,52,56,44,54,60,80,28,30,31,40,46,47,72,76,88,92,94,104,8,101,1,42,4,25,97,81,6,7,3,2,73,49,13,5,9,11,17,33,65,66,67,69,10,18,19,21,34,35,37,41,113,15,68,105,77,50,14,43,20,57,12,70,53,51,23,22,36,38,82,83,98,99,74,26,27,29,39,45,71,75,85,89
    };

    MPI_Comm_dup(MPI_COMM_WORLD, &comm);
    MPI_Comm_size(MPI_COMM_WORLD, &size);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);

    creator.set_file_name("data/1dc.128.txt");
    creator.set_graph_type("DIMACS");
    wmg = creator.create_weighted_mutable_graph();

    vector<int> ordering(wmg->get_num_nodes(), -1);
    eoutil.parmetis_elimination_ordering(wmg, ordering, GD_METIS_MMD, false, comm);
    if(rank == 0){
        int n = wmg->get_num_nodes();
        for(int i = 0; i < n; i++){
            assert (output[i] == ordering[i]);
        }
        cout << "Parmetis Test " << ++testcount << " : Passed" << endl;
    }
} // parmetis_with_metmmd
virtual void SetUp(){
    //SetUp is called before every test
    LOG_INIT("test.log", NULL, 0);
    creator.set_file_name("data/1dc.128.txt");
    creator.set_graph_type("DIMACS");
    wmg = creator.create_weighted_mutable_graph();
}