Skip to content

Commit a65cb01

Browse files
committed
slipping a conversion to vector
1 parent 40802c9 commit a65cb01

4 files changed

Lines changed: 20 additions & 22 deletions

File tree

include/components/components.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
4343

4444
#include "cpp_common/base_graph.hpp"
4545
#include "cpp_common/identifiers.hpp"
46-
#include "components/componentsResult.hpp"
4746

4847
namespace pgrouting {
4948
namespace algorithms {
@@ -55,11 +54,11 @@ std::vector<std::vector<int64_t>>
5554
pgr_connectedComponents(pgrouting::UndirectedGraph &graph);
5655

5756
//! Strongly Connected Components Vertex Version
58-
std::vector<II_t_rt>
57+
std::vector<std::vector<int64_t>>
5958
strongComponents(pgrouting::DirectedGraph &graph);
6059

6160
//! Biconnected Components (for undirected)
62-
std::vector<II_t_rt>
61+
std::vector<std::vector<int64_t>>
6362
biconnectedComponents(pgrouting::UndirectedGraph &graph);
6463

6564
//! Articulation Points

src/coloring/coloring_driver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void do_coloring(
108108
digraph.insert_edges(edges);
109109
switch (which) {
110110
case STRONGCOMPONENTS:
111-
results = strongComponents(digraph);
111+
component_results = strongComponents(digraph);
112112
break;
113113
default:
114114
err << __FILE_NAME__ << ": Unknown function with name '" << get_name(which)
@@ -129,7 +129,7 @@ void do_coloring(
129129
results = sequentialVertexColoring(undigraph);
130130
break;
131131
case BICONNECTEDCOMPONENTS:
132-
results = biconnectedComponents(undigraph);
132+
component_results = biconnectedComponents(undigraph);
133133
break;
134134
case MAKECONNECTED:
135135
{

src/components/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ ADD_LIBRARY(components OBJECT
99
bridges.c
1010
makeConnected.c
1111

12-
componentsResult.cpp
1312
components.cpp
1413
)

src/components/components.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ std::vector<std::vector<int64_t>>
4848
pgr_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

123125
Identifiers<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

Comments
 (0)