int MTPGraph::retrieve_one_path(Edge *e, Path *path) {
Edge *f, *next = 0;
- int l = 0;
+ int l = 0, nb_occupied_next;
if(path) {
path->nodes[l++] = e->origin_vertex->id;
path->nodes[l++] = e->terminal_vertex->id;
path->length += e->length;
} else l++;
- int nb_choices = 0;
+
+ nb_occupied_next = 0;
for(f = e->terminal_vertex->leaving_edges; f; f = f->next_leaving_edge) {
- if(f->occupied) { nb_choices++; next = f; }
+ if(f->occupied) { nb_occupied_next++; next = f; }
}
#ifdef DEBUG
- if(nb_choices == 0) {
+ if(nb_occupied_next == 0) {
cerr << "retrieve_one_path: Non-sink end point." << endl;
abort();
}
- if(nb_choices > 1) {
+
+ else if(nb_occupied_next > 1) {
cerr << "retrieve_one_path: Non node-disjoint paths." << endl;
abort();
}
void MTPGraph::retrieve_disjoint_paths() {
Edge *e;
+ int p, l;
for(int p = 0; p < nb_paths; p++) delete paths[p];
delete[] paths;
paths = new Path *[nb_paths];
- int p = 0;
+ p = 0;
for(e = _source->leaving_edges; e; e = e->next_leaving_edge) {
if(e->occupied) {
- int l = retrieve_one_path(e, 0);
+ l = retrieve_one_path(e, 0);
paths[p] = new Path(l);
retrieve_one_path(e, paths[p]);
p++;
// the total correction when compiled in VERBOSE mode.
void force_positivized_lengths();
- // Set the edge pred_edge_toward_source correspondingly to the path
- // of shortest length. The current implementation is not Dijkstra's!
+ // Set in every vertex pred_edge_toward_source correspondingly to
+ // the path of shortest length. The current implementation is not
+ // Dijkstra's!
void find_shortest_path();
// Follows the path starting on edge e and returns the number of