Skip to content

Commit

Permalink
Updates to reflect P1709 changes
Browse files Browse the repository at this point in the history
null_range --> null_predecessors in dijkstra_clrs
Add neighbor_descriptor for consistency
Tweak index_adjacency_list
  • Loading branch information
pratzl committed Dec 7, 2023
1 parent 57369fb commit 81e9b5e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/graph/algorithm/dijkstra_clrs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class null_range_type : public std::vector<size_t> {
null_range_type(std::initializer_list<T> init, const Allocator& alloc = Allocator()) {}
};

inline static null_range_type null_range;
inline static null_range_type null_predecessors;


template <class... Ts>
Expand Down
18 changes: 13 additions & 5 deletions include/graph/graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,16 @@ inline constexpr bool is_undirected_edge_v = false;
* @tparam G The graph type.
*/
template <class G>
concept vertex_range = ranges::forward_range<vertex_range_t<G>> && ranges::sized_range<vertex_range_t<G>> && //
requires(G&& g, vertex_iterator_t<G> ui) { vertex_id(g, ui); };
concept _common_vertex_range = ranges::sized_range<vertex_range_t<G>> && //
requires(G&& g, vertex_iterator_t<G> ui) { vertex_id(g, ui); };

template <class G>
concept index_vertex_range = ranges::random_access_range<vertex_range_t<G>> && ranges::sized_range<vertex_range_t<G>> &&
integral<vertex_id_t<G>> && //
requires(G&& g, vertex_iterator_t<G> ui) { vertex_id(g, ui); };
concept vertex_range = _common_vertex_range<G> && ranges::forward_range<vertex_range_t<G>>;

template <class G>
concept index_vertex_range = _common_vertex_range<G> && //
ranges::random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>>;


/**
* @ingroup graph_concepts
Expand Down Expand Up @@ -202,6 +205,11 @@ concept index_adjacency_list = basic_index_adjacency_list<G> && requires(G&& g,
{ edges(g, u) } -> ranges::forward_range;
};

//template <class G>
//concept index_adjacency_list = adjacency_list<G> && //
// ranges::random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>>;


// !is_same_v<vertex_range_t<G>, vertex_edge_range_t<G>>
// CSR fails this condition b/c row_index & col_index are both index_vectors; common?

Expand Down
9 changes: 9 additions & 0 deletions include/graph/graph_descriptors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ struct neighbor_descriptor<VId, true, void, void> {
target_id_type target_id;
};

//
// copyable_edge_t
//
template <class VId, class VV>
using copyable_neighbor_t = neighbor_descriptor<VId, true, void, VV>; // {source_id, target_id [, value]}

//
// view concepts
//
Expand All @@ -277,6 +283,9 @@ concept copyable_vertex = convertible_to<T, copyable_vertex_t<VId, VV>>;
template <class T, class VId, class EV>
concept copyable_edge = convertible_to<T, copyable_edge_t<VId, EV>>;

template <class T, class VId, class EV>
concept copyable_neighbor = convertible_to<T, copyable_neighbor_t<VId, EV>>;

//
// is_sourced<G>
//
Expand Down

0 comments on commit 81e9b5e

Please sign in to comment.