6 #ifndef ALTERNATING_PATH_HPP
7 #define ALTERNATING_PATH_HPP
10 #include <boost/graph/adjacency_list.hpp>
11 #include <boost/graph/max_cardinality_matching.hpp>
14 #include "utils/graph_typedefs.hpp"
15 #include "utils/graph_utils.hpp"
31 bool edge_on_alternating_cycle(
const Vertex<Graph>& u,
32 const Vertex<Graph>& v,
34 const Matching<Graph>& match)
38 assert(boost::edge(u, v, g).second);
40 assert(boost::num_vertices(g) == 2 * match.size());
43 Matching<Graph> translate;
44 boost::copy_graph(g, h, orig_to_copy(associative_property_map<Matching<Graph> >(translate)).vertex_index_map(boost::get(&Graph::vertex_bundled::index, g)));
46 Vertex<Graph>& u_in_h = translate.at(u);
47 Vertex<Graph>& v_in_h = translate.at(v);
48 const Edge<Graph> uv_in_h = boost::edge(u_in_h, v_in_h, h).first;
51 Matching<Graph> match_in_h;
52 for(
const VertexPair<Graph>& uv: match)
53 match_in_h.emplace(VertexPair<Graph>(translate.at(uv.first), translate.at(uv.second)));
56 if(match_in_h.at(u_in_h) != v_in_h) {
58 for(
const Vertex<Graph>& x: {u_in_h, v_in_h}){
59 remove_matching_pair<Graph>(x, match_in_h);
60 boost::clear_vertex(x, h);
62 }
else boost::remove_edge(uv_in_h, h);
64 typedef typename boost::associative_property_map<Matching<Graph> > MateMap;
65 MateMap matching(match_in_h);
66 boost::edmonds_augmenting_path_finder<Graph, MateMap, VertexIndexMap<Graph> >
67 augmentor(h, matching, boost::get(&Graph::vertex_bundled::index, h));
70 return augmentor.augment_matching();
Definition: read_adj_list.hpp:22