//////////////////////////////////////////////////////////////////////
-void MTPGraph::print() {
+void MTPGraph::print(ostream *os) {
for(int k = 0; k < _nb_edges; k++) {
Edge *e = _edges + k;
- cout << e->origin_vertex->id
+ (*os) << e->origin_vertex->id
<< " -> "
<< e->terminal_vertex->id
<< " "
<< e->length;
if(e->occupied) {
- cout << " *";
+ (*os) << " *";
}
- cout << endl;
+ (*os) << endl;
}
}
-void MTPGraph::print_dot() {
- cout << "digraph {" << endl;
- cout << " node[shape=circle];" << endl;
+void MTPGraph::print_dot(ostream *os) {
+ (*os) << "digraph {" << endl;
+ (*os) << " node[shape=circle];" << endl;
for(int k = 0; k < _nb_edges; k++) {
Edge *e = _edges + k;
if(e->occupied) {
- cout << " " << e->origin_vertex->id << " -> " << e->terminal_vertex->id
- << " [style=bold,color=black,label=\"" << -e->length << "\"];" << endl;
+ (*os) << " " << e->origin_vertex->id << " -> " << e->terminal_vertex->id
+ << " [style=bold,color=black,label=\"" << e->length << "\"];" << endl;
} else {
- cout << " " << e->origin_vertex->id << " -> " << e->terminal_vertex->id
+ (*os) << " " << e->origin_vertex->id << " -> " << e->terminal_vertex->id
<< " [color=gray,label=\"" << e->length << "\"];" << endl;
}
}
- cout << "}" << endl;
+ (*os) << "}" << endl;
}
//////////////////////////////////////////////////////////////////////
for(int e = 0; e < _nb_edges; e++) {
_edges[e].length = lengths[e];
+ _edges[e].occupied = 0;
_edges[e].positivized_length = _edges[e].length;
}
// If that length is negative
if(total_length < 0.0) {
#ifdef VERBOSE
- cout << "Found a path of length " << total_length << endl;
+ cerr << "Found a path of length " << total_length << endl;
#endif
// Invert all the edges along the best path
v = _sink;