24 #ifndef INCLUDE_COMPONENTS_PGR_MAKECONNECTED_HPP_
25 #define INCLUDE_COMPONENTS_PGR_MAKECONNECTED_HPP_
28 #include <boost/graph/adjacency_list.hpp>
29 #include <boost/graph/properties.hpp>
30 #include <boost/graph/graph_traits.hpp>
31 #include <boost/property_map/property_map.hpp>
32 #include <boost/graph/connected_components.hpp>
33 #include <boost/graph/make_connected.hpp>
34 #include <boost/ref.hpp>
53 typedef typename G::E_i
E_i;
60 std::vector<size_t> component(boost::num_vertices(graph.graph));
61 auto comp = boost::connected_components(graph.graph, &component[0]);
63 auto edgeCount = boost::num_edges(graph.graph);
65 log <<
"Number of Components before: " << boost::connected_components(graph.graph, &component[0]) <<
"\n";
69 CHECK_FOR_INTERRUPTS();
71 boost::make_connected(graph.graph);
72 }
catch (boost::exception
const& ex) {
75 }
catch (std::exception &e) {
82 log <<
"Number of Components after: " << boost::connected_components(graph.graph, &component[0]) <<
"\n";
84 std::vector< pgr_makeConnected_t > results(comp);
85 for (boost::tie(ei, ei_end) = edges(graph.graph); ei != ei_end; ++ei) {
86 int64_t src = graph[graph.source(*ei)].id;
87 int64_t tgt = graph[graph.target(*ei)].id;
88 log<<
"src:" << src<<
"tgt:" << tgt <<
"\n";
89 if (newEdge >= edgeCount) {
90 results[i].start_vid = src;
91 results[i].end_vid = tgt;
102 #endif // INCLUDE_COMPONENTS_PGR_MAKECONNECTED_HPP_