/* Assumptions on arguments: -n must be present, the number of nodes. * -t may or may not be present. If it is, then it's # threads. If not, * indicates serial execution. If filename not present, read from stdin. */ int main(int argc, char *argv[]) { int n_nodes = 0, n_threads = 0; char *filename, *outfile = NULL; int opt; while (opt = getopt(argc, argv, "n:t:o:"), opt != -1) { switch (opt) { case 'n': n_nodes = (int) strtol(argv[optind], NULL, 10); break; case 't': n_threads = (int) strtol(argv[optind], NULL, 10); break; case 'o': outfile = argv[optind]; break; } } if (optind >= argc) { filename = NULL; } else { filename = argv[optind]; } /* Initialize adj matrix and fill it in */ int *adj_matrix = malloc (n_nodes * n_nodes * sizeof(int)); from_csv(adj_matrix, filename, n_nodes); if (n_threads == 0) { fw_serial(adj_matrix, n_nodes); } else { fw_parallel(adj_matrix, n_nodes, n_threads); } to_csv(adj_matrix, outfile, n_nodes); return 0; }
// read csv format BOOLINT minipath::read_csv_format(ministrings &csv) { from_csv(csv); return(csv.empty()); }
// deserialization void minipath::from_stdstring(const std::string &csv) { ministrings strs; strs.from_string(csv.c_str(),"\n"); from_csv(strs); }