X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=mtp_graph.cc;h=eb4d3cce05ff1da3f8cea077bdf6070d5d5eab4c;hb=455e5736828233445ac8aea8f15b3bde7e16e9bf;hp=fe74dd1da3260f188205d326e262ac3edba4dd3f;hpb=0f54e5005de0f05d4bc400f23181301eb40f469e;p=mtp.git diff --git a/mtp_graph.cc b/mtp_graph.cc index fe74dd1..eb4d3cc 100644 --- a/mtp_graph.cc +++ b/mtp_graph.cc @@ -236,3 +236,19 @@ void MTPGraph::find_best_paths(scalar_t *lengths, int *result_edge_occupation) { } } } + +void dot_print(int nb_vertices, + int nb_edges, int *ea, int *eb, scalar_t *el, + int source, int sink, + int *edge_occupation) { + cout << "digraph {" << endl; + cout << " node[shape=circle];" << endl; + for(int e = 0; e < nb_edges; e++) { + if(edge_occupation[e]) { + cout << " " << ea[e] << " -> " << eb[e] << " [style=bold,color=black,label=\"" << el[e] << "\"];" << endl; + } else { + cout << " " << ea[e] << " -> " << eb[e] << " [color=gray,label=\"" << el[e] << "\"];" << endl; + } + } + cout << "}" << endl; +}