+ } while(shortest_path_length < 0.0);
+
+ // Put back the graph in its original state (i.e. invert edges which
+ // have been inverted in the process)
+ for(int k = 0; k < _nb_edges; k++) {
+ e = _edges + k;
+ if(e->occupied) { e->invert(); }
+ }
+}
+
+int MTPGraph::retrieve_one_path(Edge *e, Path *path) {
+ Edge *f, *next = 0;
+ int l = 0, nb_occupied_next;
+
+ if(path) {
+ path->nodes[l++] = e->origin_vertex - _vertices;
+ path->length = e->length;
+ } else l++;
+
+ while(e->terminal_vertex != _sink) {
+ if(path) {
+ path->nodes[l++] = e->terminal_vertex - _vertices;
+ path->length += e->length;
+ } else l++;
+
+ nb_occupied_next = 0;
+ for(f = e->terminal_vertex->leaving_edge_list_root; f; f = f->next_leaving_edge) {
+ if(f->occupied) { nb_occupied_next++; next = f; }
+ }
+
+#ifdef DEBUG
+ if(nb_occupied_next == 0) {
+ cerr << __FILE__ << ": retrieve_one_path: Non-sink end point." << endl;
+ abort();
+ }
+
+ else if(nb_occupied_next > 1) {
+ cerr << __FILE__ << ": retrieve_one_path: Non node-disjoint paths." << endl;
+ abort();
+ }
+#endif
+
+ e = next;
+ }
+
+ if(path) {
+ path->nodes[l++] = e->terminal_vertex - _vertices;
+ path->length += e->length;
+ } else l++;
+
+ return l;
+}
+
+void MTPGraph::retrieve_disjoint_paths() {
+ Edge *e;
+ int p, l;
+
+ for(int p = 0; p < nb_paths; p++) delete paths[p];
+ delete[] paths;
+
+ nb_paths = 0;
+ for(e = _source->leaving_edge_list_root; e; e = e->next_leaving_edge) {
+ if(e->occupied) { nb_paths++; }
+ }
+
+ paths = new Path *[nb_paths];
+
+ p = 0;
+ for(e = _source->leaving_edge_list_root; e; e = e->next_leaving_edge) {
+ if(e->occupied) {
+ l = retrieve_one_path(e, 0);
+ paths[p] = new Path(l);
+ retrieve_one_path(e, paths[p]);
+ p++;