int main (int argc, char **argv ) { if (argc < 4 || argc > 5) { usage(); } vertex_count=str2int(argv[1]); edge_count=str2int(argv[2]); max_weight=str2int(argv[3]); if(argc == 5) { int il = str2int(argv[4]); if((il >= ERROR && il <= DEBUG) || (il == TEST)) { level = il; } } //Seed init srand( ( unsigned short ) time( NULL ) ); //Fix imbalanced graph max_edges = (vertex_count * ( vertex_count - 1 )) / 2; edge_count = (edge_count > max_edges) ? max_edges : edge_count; random_graph(); if(adj_matrix != 0) { print_graph(); runAlgorithm(DIJKSTRA); if(valid > 0) { runAlgorithm(AUCTION); log(TEST, -1, "%d\t%d\t%d\t%d\t%d\t%f\t%f", vertex_count, edge_count, max_weight, dijk_dist, auct_dist, dijk_time, auct_time); } } else { log(WARNING, -1, "Graph not generated!"); } return 0; }
void demo_map() { graph_generator* random_generator = new map_graph_generator(20, 100, 4); std::shared_ptr<graph_generator> random_graph(random_generator); demo(random_graph); }
void demo_filled() { graph_generator* random_generator = new graph_generator(10, 90); std::shared_ptr<graph_generator> random_graph(random_generator); demo(random_graph); }