Skip to content

Commit be1200a

Browse files
authored
Merge pull request #3103 from cvvergara/coloring-using-one-process_and-driver
coloring using one process and driver
2 parents 4fae3d3 + 724a76e commit be1200a

28 files changed

Lines changed: 800 additions & 1279 deletions

.github/workflows/update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
runs-on: ubuntu-latest
4848

4949
strategy:
50-
fail-fast: false
50+
fail-fast: true
5151
matrix:
5252
boost_minor: [56]
5353
old_pgr: [4.0.1, 4.0.0, 3.8.0, 3.7.3, 3.7.2, 3.7.1, 3.7.0, 3.6.3, 3.6.2, 3.6.1, 3.6.0, 3.5.1, 3.5.0, 3.4.2, 3.4.1, 3.4.0, 3.3.5, 3.3.4, 3.3.3, 3.3.2, 3.3.1, 3.3.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.6, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.2.0, 3.2.1, 3.2.2]

NEWS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ To see all issues & pull requests closed by this release see the
2424
* [#3086](https://github.com/pgRouting/pgrouting/issues/3086): MaxFlow: create and use a process and driver
2525
* [#3089](https://github.com/pgRouting/pgrouting/issues/3089): edgeDisjoint and bellmanFord use shortestPath driver and
2626
process
27+
* [#3100](https://github.com/pgRouting/pgrouting/issues/3100): Coloring: create and use a process & driver
28+
29+
**Bug Fixes**
30+
31+
* [#3101](https://github.com/pgRouting/pgrouting/issues/3101): pgr_edgeColoring not building graph correctly
32+
33+
34+
**Summary of changes by function**
35+
36+
* pgr_edgeColoring
37+
38+
* Fix the way it builds the graph
2739

2840
## pgRouting 4.0
2941

doc/coloring/pgr_edgeColoring.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ graphs
2020

2121
.. rubric:: Availability
2222

23+
.. rubric:: Version 4.1.0
24+
25+
* Fix the way it builds the graph
26+
2327
.. rubric:: Version 4.0.0
2428

2529
* Output columns standardized to |result_edge_color|

doc/src/release_notes.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ To see all issues & pull requests closed by this release see the
4949
* :issue:`3086`: MaxFlow: create and use a process and driver
5050
* :issue:`3089`: edgeDisjoint and bellmanFord use shortestPath driver and
5151
process
52+
* :issue:`3100`: Coloring: create and use a process & driver
53+
54+
.. rubric:: Bug Fixes
55+
56+
* :issue:`3101`: pgr_edgeColoring not building graph correctly
57+
58+
59+
.. rubric:: Summary of changes by function
60+
61+
* pgr_edgeColoring
62+
63+
.. include:: pgr_edgeColoring.rst
64+
:start-after: Version 4.1.0
65+
:end-before: .. rubric
5266

5367
pgRouting 4.0
5468
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

docqueries/coloring/edgeColoring.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ SELECT edge, color FROM pgr_edgeColoring(
1212
);
1313
edge | color
1414
------+-------
15-
1 | 3
15+
1 | 1
1616
2 | 2
1717
3 | 3
1818
4 | 4

include/c_common/enums.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ enum Which { // NOLINT(cppcoreguidelines-use-enum-class)
4747
DFS = 520,
4848
BFS = 530,
4949
DIJKSTRADD = 540,
50-
MAXFLOW, PUSHRELABEL, BOYKOV, EDMONDSKARP
50+
/* For flow */
51+
MAXFLOW, PUSHRELABEL, BOYKOV, EDMONDSKARP,
52+
/* For coloring */
53+
EDGECOLORING, BIPARTITE, SEQUENTIAL
5154
};
5255

5356
#endif // INCLUDE_C_COMMON_ENUMS_H_
Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*PGR-GNU*****************************************************************
2-
File: bipartite_driver.h
2+
File: bipartite.hpp
33
44
Generated with Template by:
5-
Copyright (c) 2013-2026 pgRouting developers
5+
Copyright (c) 2021-2026 pgRouting developers
66
Mail: project@pgrouting.org
77
88
Function's developer:
@@ -27,33 +27,22 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2727
2828
********************************************************************PGR-GNU*/
2929

30-
#ifndef INCLUDE_DRIVERS_COLORING_BIPARTITE_DRIVER_H_
31-
#define INCLUDE_DRIVERS_COLORING_BIPARTITE_DRIVER_H_
3230

31+
#ifndef INCLUDE_COLORING_BIPARTITE_HPP_
32+
#define INCLUDE_COLORING_BIPARTITE_HPP_
33+
#pragma once
3334

34-
/* for size-t */
35-
#ifdef __cplusplus
36-
# include <cstddef>
37-
using II_t_rt = struct II_t_rt;
38-
#else
39-
# include <stddef.h>
40-
typedef struct II_t_rt II_t_rt;
41-
#endif
35+
#include <vector>
4236

37+
#include "c_types/ii_t_rt.h"
38+
#include "cpp_common/base_graph.hpp"
4339

44-
#ifdef __cplusplus
45-
extern "C" {
46-
#endif
40+
namespace pgrouting {
41+
namespace functions {
4742

48-
void
49-
pgr_do_bipartite(
50-
const char*,
43+
std::vector<II_t_rt> pgr_bipartite(const pgrouting::UndirectedGraph&);
5144

52-
II_t_rt**, size_t*,
53-
char**, char**, char**);
45+
} // namespace functions
46+
} // namespace pgrouting
5447

55-
#ifdef __cplusplus
56-
}
57-
#endif
58-
59-
#endif // INCLUDE_DRIVERS_COLORING_BIPARTITE_DRIVER_H_
48+
#endif // INCLUDE_COLORING_BIPARTITE_HPP_

include/coloring/bipartite_driver.hpp

Lines changed: 0 additions & 97 deletions
This file was deleted.

include/coloring/edgeColoring.hpp

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -30,56 +30,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
3030
#define INCLUDE_COLORING_EDGECOLORING_HPP_
3131
#pragma once
3232

33-
#include <iostream>
34-
#include <map>
3533
#include <vector>
3634
#include <cstdint>
3735

38-
#include <boost/config.hpp>
39-
#include <boost/graph/adjacency_list.hpp>
40-
#include <boost/version.hpp>
41-
42-
#include "cpp_common/edge_t.hpp"
4336
#include "c_types/ii_t_rt.h"
44-
#include "cpp_common/assert.hpp"
45-
#include "cpp_common/messages.hpp"
37+
#include "cpp_common/base_graph.hpp"
4638

4739
namespace pgrouting {
4840
namespace functions {
4941

50-
class Pgr_edgeColoring : public Pgr_messages {
51-
public:
52-
using EdgeColoring_Graph =
53-
boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property,
54-
int64_t, boost::no_property>;
55-
56-
using V = boost::graph_traits<EdgeColoring_Graph>::vertex_descriptor;
57-
using E = boost::graph_traits<EdgeColoring_Graph>::edge_descriptor;
58-
using V_it = boost::graph_traits<EdgeColoring_Graph>::vertex_iterator;
59-
using E_it = boost::graph_traits<EdgeColoring_Graph>::edge_iterator;
60-
61-
public:
62-
std::vector<II_t_rt> edgeColoring();
63-
64-
explicit Pgr_edgeColoring(const std::vector<Edge_t>&);
65-
Pgr_edgeColoring() = delete;
66-
67-
#if BOOST_VERSION >= 106800
68-
friend std::ostream& operator<<(std::ostream &, const Pgr_edgeColoring&);
69-
#endif
70-
71-
private:
72-
V get_boost_vertex(int64_t id) const;
73-
int64_t get_vertex_id(V v) const;
74-
int64_t get_edge_id(E e) const;
75-
42+
std::vector<II_t_rt> edgeColoring(const pgrouting::UndirectedGraph&);
7643

77-
private:
78-
EdgeColoring_Graph graph;
79-
std::map<int64_t, V> id_to_V;
80-
std::map<V, int64_t> V_to_id;
81-
std::map<E, int64_t> E_to_id;
82-
};
8344

8445
} // namespace functions
8546
} // namespace pgrouting

0 commit comments

Comments
 (0)