BGL_FORALL_VERTICES(v, g, Graph) { BGL_FORALL_VERTICES(u, g, Graph) { // For 'v', compute edge_label -> edge_descriptor map map<int, Graph::edge_descriptor> label2edge; BGL_FORALL_OUTEDGES(v, edge, g, Graph) { label2edge[get(edge_weight, g)[edge]] = edge; } // For 'u' edges, find the 'v' edge with the same label, // and find the new pair of states. BGL_FORALL_OUTEDGES(u, edge2, g, Graph) { Graph::edge_descriptor edge = label2edge[ get(edge_weight, g)[edge2]]; // ....... } } }
Of course, it does not change the fact that code which uses Boost.Preprocessor tend to be
less readable than Perl. And it does not change the fact that we need
in-language foreach
.
1 comment:
ha ha, you code in C++
Post a Comment