Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ To see all issues & pull requests closed by this release see the
* [#3089](https://github.com/pgRouting/pgrouting/issues/3089): edgeDisjoint and bellmanFord use shortestPath driver and
process
* [#3100](https://github.com/pgRouting/pgrouting/issues/3100): Coloring: create and use a process & driver
* [#3113](https://github.com/pgRouting/pgrouting/issues/3113): Components: Integrate into existing process/driver pair

**Bug Fixes**

Expand Down
1 change: 1 addition & 0 deletions doc/src/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ To see all issues & pull requests closed by this release see the
* :issue:`3089`: edgeDisjoint and bellmanFord use shortestPath driver and
process
* :issue:`3100`: Coloring: create and use a process & driver
* :issue:`3113`: Components: Integrate into existing process/driver pair

.. rubric:: Bug Fixes

Expand Down
5 changes: 4 additions & 1 deletion include/c_common/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ enum Which { // NOLINT(cppcoreguidelines-use-enum-class)
/* For flow */
MAXFLOW, PUSHRELABEL, BOYKOV, EDMONDSKARP,
/* For coloring */
EDGECOLORING, BIPARTITE, SEQUENTIAL
EDGECOLORING, BIPARTITE, SEQUENTIAL,
/* For components */
CONNECTEDCOMPONENTS, BICONNECTEDCOMPONENTS, STRONGCOMPONENTS, ARTICULATIONPOINTS,
BRIDGES, MAKECONNECTED
};

#endif // INCLUDE_C_COMMON_ENUMS_H_
9 changes: 4 additions & 5 deletions include/components/components.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,22 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include "cpp_common/base_graph.hpp"
#include "cpp_common/identifiers.hpp"
#include "components/componentsResult.hpp"

namespace pgrouting {
namespace algorithms {

/**
* works for undirected graph
**/
std::vector<II_t_rt>
pgr_connectedComponents(pgrouting::UndirectedGraph &graph);
std::vector<std::vector<int64_t>>
connectedComponents(pgrouting::UndirectedGraph &graph);

//! Strongly Connected Components Vertex Version
std::vector<II_t_rt>
std::vector<std::vector<int64_t>>
strongComponents(pgrouting::DirectedGraph &graph);

//! Biconnected Components (for undirected)
std::vector<II_t_rt>
std::vector<std::vector<int64_t>>
biconnectedComponents(pgrouting::UndirectedGraph &graph);

//! Articulation Points
Expand Down
52 changes: 0 additions & 52 deletions include/components/componentsResult.hpp

This file was deleted.

51 changes: 2 additions & 49 deletions include/components/makeConnected.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,56 +50,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
namespace pgrouting {
namespace functions {

template < class G >
class Pgr_makeConnected : public pgrouting::Pgr_messages {
public:
typedef typename G::V V;
typedef typename G::E E;
typedef typename G::E_i E_i;
std::vector<II_t_rt> makeConnected(G &graph) {
return generatemakeConnected(graph);
}
std::vector<II_t_rt>
makeConnected(pgrouting::UndirectedGraph &graph);

private:
std::vector< II_t_rt > generatemakeConnected(G &graph ) {
std::vector<size_t> component(boost::num_vertices(graph.graph));
auto comp = boost::connected_components(graph.graph, &component[0]);
comp--;
auto edgeCount = boost::num_edges(graph.graph);
size_t newEdge = 0;
log << "Number of Components before: " << boost::connected_components(graph.graph, &component[0]) << "\n";
size_t i = 0;

/* abort in case of an interruption occurs (e.g. the query is being cancelled) */
CHECK_FOR_INTERRUPTS();
try {
boost::make_connected(graph.graph);
} catch (boost::exception const& ex) {
(void)ex;
throw;
} catch (std::exception &e) {
(void)e;
throw;
} catch (...) {
throw;
}

log << "Number of Components after: " << boost::connected_components(graph.graph, &component[0]) << "\n";
E_i ei, ei_end;
std::vector< II_t_rt > results(comp);
for (boost::tie(ei, ei_end) = edges(graph.graph); ei != ei_end; ++ei) {
int64_t src = graph[graph.source(*ei)].id;
int64_t tgt = graph[graph.target(*ei)].id;
log<< "src:" << src<< "tgt:" << tgt <<"\n";
if (newEdge >= edgeCount) {
results[i] = {src, tgt};
i++;
}
newEdge++;
}
return results;
}
};
} // namespace functions
} // namespace pgrouting

Expand Down
44 changes: 36 additions & 8 deletions include/cpp_common/to_postgres.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include "c_types/contractionHierarchies_rt.h"
#include "c_types/iid_t_rt.h"
#include "c_types/ii_t_rt.h"
#include "c_types/routes_t.h"
#include "c_types/path_rt.h"
#include "c_types/mst_rt.h"
Expand All @@ -53,34 +54,40 @@ size_t count_rows(const std::vector<std::vector<double>>&);

} // namespace detail

/*
/**
* @brief Via Routes save on a C array
*/
size_t get_viaRoute(std::deque<pgrouting::Path>&, Routes_t**);

/*
/**
* @brief get tuples from a Path to a Path_rt
*/
size_t get_tuples(const std::deque<pgrouting::Path>&, Path_rt*&);


/*
/**
* @brief get tuples from a Path to a MST_rt
*/
size_t get_tuples(const std::deque<pgrouting::Path>&, MST_rt*&);

/*
/**
* @brief get tuples for Flow_t
*/
size_t get_tuples(const std::vector<Flow_t>&, Flow_t*&);

/*
/**
* @brief get tuples for Path_rt
*/
size_t
get_tuples(std::vector<Path_rt>&, const std::vector<Edge_t>&, Path_rt*&);

/*
size_t
get_tuples(const std::vector<II_t_rt>&, II_t_rt*&);

size_t
get_tuples(std::vector<std::vector<int64_t>>&, II_t_rt*&);


/**
* @brief get tuples for spanning tree driver
*/
size_t get_tuples(
Expand All @@ -89,11 +96,32 @@ size_t get_tuples(
const std::vector<std::map<int64_t, int64_t>>&,
MST_rt*&);

/*
/**
* @brief get tuples from a vector of MST_rt to a MST_rt
*/
size_t get_tuples(const std::vector<MST_rt>&, MST_rt*&);

/**
* @brief get tuples from Identifiers
*/
template <class T>
size_t get_identifiers(
const Identifiers<T> &ids,
int64_t* &tuples) {
pgassert(!tuples);

auto count = ids.size();
if (count == 0) return 0;

tuples = pgrouting::pgr_alloc(count, tuples);

size_t i = 0;
for (const auto &id : ids) {
tuples[i++] = id;
}
return count;
}

/** @brief Vector of vertices id are saved on a C array
*
* @param[in] graph Created graph with the base Graph
Expand Down
1 change: 1 addition & 0 deletions include/drivers/coloring_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ namespace drivers {

void do_coloring(
const std::string&,
bool,
Which,
II_t_rt*&, size_t&,
std::ostringstream&, std::ostringstream&, std::ostringstream&);
Expand Down
61 changes: 0 additions & 61 deletions include/drivers/components/articulationPoints_driver.h

This file was deleted.

60 changes: 0 additions & 60 deletions include/drivers/components/biconnectedComponents_driver.h

This file was deleted.

Loading
Loading