30 #ifndef INCLUDE_CONTRACTION_PGR_LINEARCONTRACTION_HPP_
31 #define INCLUDE_CONTRACTION_PGR_LINEARCONTRACTION_HPP_
35 #include <boost/graph/iteration_macros.hpp>
36 #include <boost/graph/filtered_graph.hpp>
46 namespace contraction {
52 typedef typename G::V_i
V_i;
53 typedef typename G::B_G
B_G;
82 BGL_FORALL_VERTICES_T(v, graph.graph,
B_G) {
107 graph.find_adjacent_vertices(v);
110 V u = adjacent_vertices.
front();
112 V w = adjacent_vertices.
front();
119 if (graph.is_directed()) {
137 graph[v].contracted_vertices().clear();
138 boost::clear_vertex(v, graph.graph);
167 auto e1 = graph.get_min_cost_edge(u, v);
168 auto e2 = graph.get_min_cost_edge(v, w);
170 if (std::get<2>(e1) && std::get<2>(e2)) {
171 auto contracted_vertices = std::get<1>(e1) + std::get<1>(e2);
172 double cost = std::get<0>(e1) + std::get<0>(e2);
173 contracted_vertices += graph[v].id;
174 contracted_vertices += graph[v].contracted_vertices();
184 graph.add_shortcut(shortcut, u, w);
199 #endif // INCLUDE_CONTRACTION_PGR_LINEARCONTRACTION_HPP_