@@ -48,10 +48,10 @@ std::vector<std::vector<int64_t>>
4848pgr_connectedComponents (pgrouting::UndirectedGraph &graph) {
4949 if (boost::num_vertices (graph.graph ) == 0 ) return {};
5050 typedef pgrouting::UndirectedGraph::V V;
51- // perform the algorithm
51+
5252 std::vector<V> components (boost::num_vertices (graph.graph ));
5353 size_t num_comps = 0 ;
54- /* abort in case of an interruption occurs (e.g. the query is being cancelled) */
54+
5555 CHECK_FOR_INTERRUPTS ();
5656 try {
5757 num_comps = boost::connected_components (graph.graph , components.data ());
@@ -69,13 +69,14 @@ pgr_connectedComponents(pgrouting::UndirectedGraph &graph) {
6969}
7070
7171// ! Strongly Connected Components Vertex Version
72- std::vector<II_t_rt> strongComponents (pgrouting::DirectedGraph &graph) {
72+ std::vector<std::vector<int64_t >>
73+ strongComponents (pgrouting::DirectedGraph &graph) {
7374 typedef pgrouting::UndirectedGraph::V V;
74- // perform the algorithm
75+
7576 std::vector<V> components (num_vertices (graph.graph ));
7677 size_t num_comps = 0 ;
77- /* abort in case of an interruption occurs (e.g. the query is being cancelled)
78- */
78+
79+
7980 CHECK_FOR_INTERRUPTS ();
8081 try {
8182 num_comps = boost::strong_components (
@@ -86,22 +87,23 @@ std::vector<II_t_rt> strongComponents(pgrouting::DirectedGraph &graph) {
8687 throw ;
8788 }
8889
89- // get the results
90+
9091 std::vector<std::vector<int64_t >> results (num_comps);
9192 for (auto vd : boost::make_iterator_range (vertices (graph.graph ))) {
9293 results[components[vd]].push_back (graph[vd].id );
9394 }
9495
95- return detail::componentsResult ( results) ;
96+ return results;
9697}
9798
9899// ! Biconnected Components
99- std::vector<II_t_rt> biconnectedComponents (pgrouting::UndirectedGraph &graph) {
100+ std::vector<std::vector<int64_t >>
101+ biconnectedComponents (pgrouting::UndirectedGraph &graph) {
100102 using G = pgrouting::UndirectedGraph;
101103 using E = G::E;
102104 using Edge_map = std::map<E, size_t >;
103105
104- // perform the algorithm
106+
105107 Edge_map bicmp_map;
106108 boost::associative_property_map<Edge_map> bimap (bicmp_map);
107109 size_t num_comps = 0 ;
@@ -117,17 +119,15 @@ std::vector<II_t_rt> biconnectedComponents(pgrouting::UndirectedGraph &graph) {
117119 results[bimap[ed]].push_back (graph[ed].id );
118120 }
119121
120- return detail::componentsResult ( results) ;
122+ return results;
121123}
122124
123125Identifiers<int64_t > articulationPoints (pgrouting::UndirectedGraph &graph) {
124126 using G = pgrouting::UndirectedGraph;
125127 using V = G::V;
126- /* abort in case of an interruption occurs (e.g. the query is being cancelled)
127- */
128+
128129 CHECK_FOR_INTERRUPTS ();
129130
130- // perform the algorithm
131131 std::vector<V> art_points;
132132 try {
133133#ifndef __clang_analyzer__
@@ -167,14 +167,14 @@ Identifiers<int64_t> bridges(pgrouting::UndirectedGraph &graph) {
167167 if (boost::num_vertices (graph.graph ) == 0 ) return bridge_edges;
168168 std::vector<V> components (boost::num_vertices (graph.graph ));
169169 size_t ini_comps = 0 ;
170- /* abort in case of an interruption occurs (e.g. the query is being cancelled) */
170+
171171 CHECK_FOR_INTERRUPTS ();
172172 try {
173173 ini_comps = boost::connected_components (graph.graph , components.data ());
174174 } catch (...) {
175175 throw ;
176176 }
177- /* abort in case of an interruption occurs (e.g. the query is being cancelled) */
177+
178178 CHECK_FOR_INTERRUPTS ();
179179 std::vector<V> art_points;
180180 try {
0 commit comments