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
34 changes: 17 additions & 17 deletions D3128_Algorithms/src/alg_comprehensive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ void breadth_first_search(ExecutionPolicy&& policy,
* BFS: multiple source
*/
template <adjacency_list_graph G, class S, property P, property D>
requires std::ranges::forward_range<S>
requires std::forward_range<S>
void breadth_first_search(const G& graph, S&& sources, P&& predecessors, D&& distances);

template <adjacency_list_graph G, class S, property P, property D, queueable Q>
requires std::ranges::forward_range<S>
requires std::forward_range<S>
void breadth_first_search(const G& graph, S&& sources, P&& predecessors, D&& distances, Q&& q);

template <class ExecutionPolicy, adjacency_list_graph G, class S, property P, property D>
requires std::ranges::forward_range<S>
requires std::forward_range<S>
void breadth_first_search(
ExecutionPolicy&& policy, const G& graph, S&& sources, P&& predecessors, D&& distances);

Expand All @@ -143,7 +143,7 @@ template <class ExecutionPolicy,
property P,
property D,
queueable Q>
requires std::ranges::forward_range<S>
requires std::forward_range<S>
void breadth_first_search(ExecutionPolicy&& policy,
const G& graph,
S&& sources,
Expand Down Expand Up @@ -179,7 +179,7 @@ void dijkstra_shortest_paths(const G& graph,
D&& distances);

template <adjacency_list_graph G, class S, property P, property D>
requires std::ranges::forward_range<S>
requires std::forward_range<S>
void dijkstra_shortest_paths(const G& graph, S&& sources, P&& predecessors, D&& distances);

/*
Expand Down Expand Up @@ -240,7 +240,7 @@ void dijkstra_shortest_paths(const G& graph,
*/

template <adjacency_list_graph G, class S, class W, property P, property D>
requires weight_function<W, edge_t<G>> && std::ranges::forward_range<S>
requires weight_function<W, edge_t<G>> && std::forward_range<S>
void dijkstra_shortest_paths(
const G& graph, S&& sources, W&& w, P&& predecessors, D&& distances) {}

Expand All @@ -251,7 +251,7 @@ template <adjacency_list_graph G,
property D,
class Compare,
class Combine>
requires weight_function<W, edge_t<G>> && std::ranges::forward_range<S>
requires weight_function<W, edge_t<G>> && std::forward_range<S>
void dijkstra_shortest_paths(const G& graph,
S&& sources,
W&& w,
Expand Down Expand Up @@ -299,11 +299,11 @@ void bellman_ford_shortest_paths(ExecutionPolicy&& e,
D&& distances);

template <edge_list_graph G, class S, property P, property D>
requires std::ranges::forward_range<S>
requires std::forward_range<S>
void bellman_ford_shortest_paths(const G& graph, S&& sources, P&& predecessors, D&& distances);

template <class ExecutionPolicy, edge_list_graph G, class S, property P, property D>
requires std::ranges::forward_range<S>
requires std::forward_range<S>
void bellman_ford_shortest_paths(
ExecutionPolicy&& e, const G& graph, S&& sources, P&& predecessors, D&& distances);

Expand Down Expand Up @@ -403,7 +403,7 @@ void bellman_ford_shortest_paths(const G& graph,
*/

template <edge_list_graph G, class S, class W, property P, property D>
requires weight_function<W, edge_t<G>> && std::ranges::forward_range<S>
requires weight_function<W, edge_t<G>> && std::forward_range<S>
void bellman_ford_shortest_paths(
const G& graph, S&& sources, W&& w, P&& predecessors, D&& distances) {}

Expand All @@ -414,7 +414,7 @@ template <edge_list_graph G,
property D,
class Compare,
class Combine>
requires weight_function<W, edge_t<G>> && std::ranges::forward_range<S>
requires weight_function<W, edge_t<G>> && std::forward_range<S>
void bellman_ford_shortest_paths(const G& graph,
S&& sources,
W&& w,
Expand All @@ -424,7 +424,7 @@ void bellman_ford_shortest_paths(const G& graph,
Combine&& comb) {}

template <class ExecutionPolicy, edge_list_graph G, class S, class W, property P, property D>
requires weight_function<W, edge_t<G>> && std::ranges::forward_range<S>
requires weight_function<W, edge_t<G>> && std::forward_range<S>
void bellman_ford_shortest_paths(ExecutionPolicy&& e,
const G& graph,
S&& sources,
Expand All @@ -440,7 +440,7 @@ template <class ExecutionPolicy,
property D,
class Compare,
class Combine>
requires weight_function<W, edge_t<G>> && std::ranges::forward_range<S>
requires weight_function<W, edge_t<G>> && std::forward_range<S>
void bellman_ford_shortest_paths(ExecutionPolicy&& e,
const G& graph,
S&& sources,
Expand Down Expand Up @@ -594,7 +594,7 @@ template <class ExecutionPolicy,
class W,
property P,
property D>
requires weight_function<W, edge_t<G>> && std::ranges::forward_range<S>
requires weight_function<W, edge_t<G>> && std::forward_range<S>
void delta_stepping_shortest_paths(ExecutionPolicy&& e,
const G& graph,
S&& sources,
Expand All @@ -610,7 +610,7 @@ template <class ExecutionPolicy,
property D,
class Compare,
class Combine>
requires weight_function<W, edge_t<G>> && std::ranges::forward_range<S>
requires weight_function<W, edge_t<G>> && std::forward_range<S>
void delta_stepping_shortest_paths(ExecutionPolicy&& e,
const G& graph,
S&& sources,
Expand All @@ -627,7 +627,7 @@ template <class ExecutionPolicy,
property P,
property D,
class T>
requires weight_function<W, edge_t<G>> && std::ranges::forward_range<S>
requires weight_function<W, edge_t<G>> && std::forward_range<S>
void delta_stepping_shortest_paths(ExecutionPolicy&& e,
const G& graph,
S&& sources,
Expand All @@ -645,7 +645,7 @@ template <class ExecutionPolicy,
class Compare,
class Combine,
class T>
requires weight_function<W, edge_t<G>> && std::ranges::forward_range<S>
requires weight_function<W, edge_t<G>> && std::forward_range<S>
void delta_stepping_shortest_paths(ExecutionPolicy&& e,
const G& graph,
S&& sources,
Expand Down
14 changes: 7 additions & 7 deletions D3128_Algorithms/src/connected_components.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ void articulation_points(G&& g, Iter cut_vertices);
* Hopcroft-Tarjan Biconnected Components
*/
template <index_adjacency_list G,
ranges::forward_range OuterContainer>
requires ranges::forward_range<ranges::range_value_t<OuterContainer>> &&
integral<ranges::forward_range_t<ranges::forward_range_t<OuterContainer>>>
forward_range OuterContainer>
requires forward_range<range_value_t<OuterContainer>> &&
integral<forward_range_t<forward_range_t<OuterContainer>>>
void biconnected_components(G&& g,
OuterContainer& components);

/*
* Connected Components
*/
template <index_adjacency_list G,
ranges::random_access_range Component>
random_access_range Component>
void connected_components(G&& g,
Component& component);

Expand All @@ -28,7 +28,7 @@ void connected_components(G&& g,
*/
template <index_adjacency_list G,
index_adjacency_list GT,
ranges::random_access_range Component>
random_access_range Component>
void strongly_connected_components(G&& g,
GT&& g_t,
Component& component);
Expand All @@ -37,7 +37,7 @@ void strongly_connected_components(G&& g,
* Tarjan Strongly Connected Components
*/
template <adjacency_list G,
ranges::random_access_range Component>
requires ranges::random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>>
random_access_range Component>
requires random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>>
void strongly_connected_components(G&& g,
Component& component);
6 changes: 3 additions & 3 deletions D3128_Algorithms/src/lp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Label Propagation Algorithm
*/
template <index_adjacency_list G,
ranges::random_access_range Label,
random_access_range Label,
class Gen = default_random_engine,
class T = size_t>
void label_propagation(G&& g,
Expand All @@ -11,11 +11,11 @@ void label_propagation(G&& g,
T max_iters = numeric_limits<T>::max());

template <index_adjacency_list G,
ranges::random_access_range Label,
random_access_range Label,
class Gen = default_random_engine
class T = size_t>
void label_propagation(G&& g,
Label& label,
ranges::range_value_t<Label>& empty_label
range_value_t<Label>& empty_label
Gen&& rng = default_random_engine {},
T max_iters = numeric_limits<T>::max());
2 changes: 1 addition & 1 deletion D3128_Algorithms/src/mis.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
template <index_adjacency_list G, class Iter>
requires output_iterator<Iter, vertex_id_t<G>>
void maximal_independent_set(G&& g, Iter mis, vertex_id_t<G> seed);
void maximal_independent_set(G&& g, Iter mis, vertex_id_t<G> source);
14 changes: 7 additions & 7 deletions D3128_Algorithms/src/mst.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ void kruskal(IELR&& e, OELR&& t, CompareOp compare);
* Prim's Algorithm
*/
template <index_adjacency_list G,
ranges::random_access_range Predecessor,
ranges::random_access_range Weight>
void prim(G&& g, Predecessor& predecessor, Weight& weight, vertex_id_t<G> seed = 0);
random_access_range Predecessor,
random_access_range Weight>
void prim(G&& g, Predecessor& predecessor, Weight& weight, vertex_id_t<G> source = 0);

template <index_adjacency_list G,
ranges::random_access_range Predecessor,
ranges::random_access_range Weight,
random_access_range Predecessor,
random_access_range Weight,
class CompareOp>
void prim(G&& g,
Predecessor& predecessor,
Weight& weight,
CompareOp compare,
ranges::range_value_t<Weight> init_dist,
vertex_id_t<G> seed = 0);
range_value_t<Weight> init_dist,
vertex_id_t<G> source = 0);
16 changes: 8 additions & 8 deletions D3128_Algorithms/src/pagerank.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
template <class ExecutionPolicy,
adjacency_list_graph G,
ranges::random_access_range P,
class EVF = std::function<ranges::range_value_t<P>(edge_reference_t<G>)>>
requires ranges::random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>> &&
is_arithmetic_v<ranges::range_value_t<P>> && edge_weight_function<G, EVF>
random_access_range P,
class EVF = std::function<range_value_t<P>(edge_reference_t<G>)>>
requires random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>> &&
is_arithmetic_v<range_value_t<P>> && edge_weight_function<G, EVF>
void pagerank(ExecutionPolicy policy,
G&& g,
P& scores,
Expand All @@ -13,10 +13,10 @@ void pagerank(ExecutionPolicy policy,
EVF weight_fn) {}

template <adjacency_list_graph G,
ranges::random_access_range P,
class EVF = std::function<ranges::range_value_t<P>(edge_reference_t<G>)>>
requires ranges::random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>> &&
is_arithmetic_v<ranges::range_value_t<P>> && edge_weight_function<G, EVF>
random_access_range P,
class EVF = std::function<range_value_t<P>(edge_reference_t<G>)>>
requires random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>> &&
is_arithmetic_v<range_value_t<P>> && edge_weight_function<G, EVF>
void pagerank(G&& g,
P& scores,
const double damping_factor,
Expand Down
14 changes: 7 additions & 7 deletions D3128_Algorithms/src/prim.hpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
template <index_adjacency_list G,
ranges::random_access_range Predecessor,
ranges::random_access_range Weight>
void prim(G&& g, Predecessor& predecessor, Weight& weight, vertex_id_t<G> seed = 0) {}
random_access_range Predecessor,
random_access_range Weight>
void prim(G&& g, Predecessor& predecessor, Weight& weight, vertex_id_t<G> source = 0) {}

template <index_adjacency_list G,
ranges::random_access_range Predecessor,
ranges::random_access_range Weight,
random_access_range Predecessor,
random_access_range Weight,
class CompareOp>
void prim(G&& g,
Predecessor& predecessor,
Weight& weight,
CompareOp compare,
ranges::range_value_t<Weight> init_dist,
vertex_id_t<G> seed = 0) {}
range_value_t<Weight> init_dist,
vertex_id_t<G> source = 0) {}
2 changes: 1 addition & 1 deletion D3128_Algorithms/src/prototypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ template <class G>
concept edge_list_graph = std::copyable<G>;

template <class P>
concept property = std::ranges::random_access_range<P>;
concept property = std::random_access_range<P>;

template <class Q>
concept queueable = std::copyable<Q> && requires(Q q) {
Expand Down
2 changes: 1 addition & 1 deletion D3128_Algorithms/src/shortest_paths_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ template <class Distances>
constexpr void init_shortest_paths(Distances& distances) {
// exposition only
ranges::fill(distances,
shortest_path_infinite_distance<ranges::range_value_t<Distances>>());
shortest_path_infinite_distance<range_value_t<Distances>>());
}

template <class Distances, class Predecessors>
Expand Down
10 changes: 5 additions & 5 deletions D3128_Algorithms/src/visitor_vertex.hpp
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
template <class G, class Visitor>
concept has_on_initialize_vertex = // For exposition only
requires(Visitor& v, vertex_info<vertex_id_t<G>, vertex_reference_t<G>, void> vdesc) {
requires(Visitor& v, vertex_info<vertex_reference_t<G>, void> vdesc) {
{ v.on_initialize_vertex(vdesc) };
};
template <class G, class Visitor>
concept has_on_discover_vertex = // For exposition only
requires(Visitor& v, vertex_info<vertex_id_t<G>, vertex_reference_t<G>, void> vdesc) {
requires(Visitor& v, vertex_info<vertex_reference_t<G>, void> vdesc) {
{ v.on_discover_vertex(vdesc) };
};
template <class G, class Visitor>
concept has_on_start_vertex = // For exposition only
requires(Visitor& v, vertex_info<vertex_id_t<G>, vertex_reference_t<G>, void> vdesc) {
requires(Visitor& v, vertex_info<vertex_reference_t<G>, void> vdesc) {
{ v.on_start_vertex(vdesc) };
};
template <class G, class Visitor>
concept has_on_examine_vertex = // For exposition only
requires(Visitor& v, vertex_info<vertex_id_t<G>, vertex_reference_t<G>, void> vdesc) {
requires(Visitor& v, vertex_info<vertex_reference_t<G>, void> vdesc) {
{ v.on_examine_vertex(vdesc) };
};
template <class G, class Visitor>
concept has_on_finish_vertex = // For exposition only
requires(Visitor& v, vertex_info<vertex_id_t<G>, vertex_reference_t<G>, void> vdesc) {
requires(Visitor& v, vertex_info<vertex_reference_t<G>, void> vdesc) {
{ v.on_finish_vertex(vdesc) };
};
Loading
Loading