From b6200435a7d9cabb7d2616f603846d99b2805a97 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Mon, 20 Aug 2012 17:05:58 -0700 Subject: [PATCH] Update. --- miniksp.cc | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/miniksp.cc b/miniksp.cc index 360289f..513da0e 100644 --- a/miniksp.cc +++ b/miniksp.cc @@ -105,17 +105,29 @@ void find_best_paths(int nb_vertices, } int main(int argc, char **argv) { - int nb_time_steps = 4; - int nb_locations = 5; - // Add the source and sink - int nb_vertices = nb_time_steps * nb_locations + 2; - int nb_edges = nb_locations + (nb_time_steps - 1) * nb_locations * nb_locations + nb_locations; - int source = 0; - int sink = nb_locations - 1; + ifstream file(argv[1]); + int nb_edges, nb_vertices; + int source, sink; + + if(file.good()) { + file >> nb_vertices >> nb_edges; + file >> source >> sink; + } + + cout << "nb_edges = " << nb_edges << endl; + cout << "nb_vertices = " << nb_vertices << endl; + cout << "source = " << source << endl; + cout << "sink = " << sink << endl; + scalar_t *es = new scalar_t[nb_edges]; int *ea = new int[nb_edges]; int *eb = new int[nb_edges]; + for(int e = 0; e < nb_edges; e++) { + file >> ea[e] >> eb[e] >> es[e]; + cout << ea[e] << " -> " << eb[e] << " [" << es[e] << "]" << endl; + } + delete[] es; delete[] ea; delete[] eb; -- 2.39.5