7 #ifndef PP_PENDANT_MATCH_HPP
8 #define PP_PENDANT_MATCH_HPP
13 #include "utils/graph_typedefs.hpp"
16 using namespace boost;
21 typedef edge_property_tag kind;
30 bool pp_matching_pendant(Instance& I,
const ScafVertex& u,
const ScafVertex& w, Solution<>* S = NULL){
32 const RawScaffoldGraph& g = I.get_graph();
33 assert(boost::degree(u, g) == 2);
34 assert(I.get_matching().at(u) != w);
37 double max_weight = 0.0;
38 ScafOEdgeIter max_edge;
39 for(ScafOEdgeIterRange r = boost::out_edges(w, g); r.first != r.second; ++r.first){
40 const ScafEdge& uv = *r.first;
41 const ScafVertex& v = boost::target(uv, g);
42 if((v != w) && (boost::degree(w, g) == 2)){
43 const unsigned weight = g[uv].weight;
44 if(weight > max_weight) {
50 const ScafVertex& max_vertex = boost::target(*max_edge, g);
53 if(max_weight != 0.0){
55 for(ScafOEdgeIterRange r = boost::out_edges(w, g); r.first != r.second;){
56 const ScafEdge& ux = *r.first;
57 const ScafVertex& x = boost::target(ux, g);
60 const unsigned weight = g[ux].weight;
61 if(weight <= max_weight){
63 DEBUG3(std::cout <<
"PP: removing "<<I.get_edge_name(ux)<<
" of weight "<< g[ux].weight<<std::endl);
64 ScafOEdgeIter tmp = r.first; ++r.first;
65 I.delete_edge(*tmp, S);
77 bool pp_matching_pendant(Instance& I, Solution<>* S = NULL){
78 const RawScaffoldGraph& g = I.get_graph();
79 const ScafMatching& matching = I.get_matching();
83 for(ScafVIterRange r = boost::vertices(g); r.first != r.second; ++r.first)
if(boost::degree(*r.first, g) == 2){
85 const ScafVertex& u = *r.first;
86 const ScafAdjIter tmp = boost::adjacent_vertices(u, g).first;
87 const ScafVertex w = (matching.at(u) == *tmp) ? *std::next(tmp) : *tmp;
88 DEBUG3(std::cout <<
"investigating "<<g[u].name<<
" unmatched with "<< g[w].name<<std::endl);
91 const bool apply_reduction = !I.is_on_alternating_cycle(u, w);
92 DEBUG3(std::cout <<
"found that ("<<g[u].name<<
", "<<g[w].name<<
") is "<< (apply_reduction?
"not":
" ")<<
" on an alteranting cycle (or we're not looking for any cycles)"<<std::endl);
96 if(pp_matching_pendant(I, u, w, S))
Definition: graph_utils.hpp:18
Definition: read_adj_list.hpp:22
Definition: pp_pendant_match.hpp:18
bool preprocess
bool indicating whether to run preprocessing or not (currently defunct)
Definition: command_line.hpp:41