Skip to content

Commit

Permalink
:octocat: Applied clang-format.
Browse files Browse the repository at this point in the history
  • Loading branch information
pratzl authored and github-actions[bot] committed Nov 12, 2023
1 parent 2913594 commit 95f3c4d
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 42 deletions.
14 changes: 7 additions & 7 deletions include/graph/container/compressed_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class csr_row_values<EV, void, GV, VId, EIndex, Alloc> {
using value_type = void;
using size_type = size_t; //VId;

public: // Properties
public: // Properties
[[nodiscard]] constexpr size_type size() const noexcept { return 0; }
[[nodiscard]] constexpr bool empty() const noexcept { return true; }
[[nodiscard]] constexpr size_type capacity() const noexcept { return 0; }
Expand Down Expand Up @@ -346,7 +346,7 @@ class csr_col_values<void, VV, GV, VId, EIndex, Alloc> {
using value_type = void;
using size_type = size_t; //VId;

public: // Properties
public: // Properties
[[nodiscard]] constexpr size_type size() const noexcept { return 0; }
[[nodiscard]] constexpr bool empty() const noexcept { return true; }
[[nodiscard]] constexpr size_type capacity() const noexcept { return 0; }
Expand Down Expand Up @@ -485,7 +485,7 @@ class compressed_graph_base
}

public:
public: // Operations
public: // Operations
void reserve_vertices(size_type count) {
row_index_.reserve(count + 1); // +1 for terminating row
row_values_base::reserve(count);
Expand Down Expand Up @@ -745,14 +745,14 @@ class compressed_graph_base
private: // tag_invoke properties
friend constexpr vertices_type tag_invoke(::std::graph::tag_invoke::vertices_fn_t, compressed_graph_base& g) {
if (g.row_index_.empty())
return vertices_type(g.row_index_); // really empty
return vertices_type(g.row_index_); // really empty
else
return vertices_type(g.row_index_.begin(), g.row_index_.end() - 1); // don't include terminating row
}
friend constexpr const_vertices_type tag_invoke(::std::graph::tag_invoke::vertices_fn_t,
const compressed_graph_base& g) {
if (g.row_index_.empty())
return const_vertices_type(g.row_index_); // really empty
return const_vertices_type(g.row_index_); // really empty
else
return const_vertices_type(g.row_index_.begin(), g.row_index_.end() - 1); // don't include terminating row
}
Expand All @@ -765,7 +765,7 @@ class compressed_graph_base
friend constexpr edges_type tag_invoke(::std::graph::tag_invoke::edges_fn_t, graph_type& g, vertex_type& u) {
static_assert(ranges::contiguous_range<row_index_vector>, "row_index_ must be a contiguous range to get next row");
vertex_type* u2 = &u + 1;
assert(static_cast<size_t>(u2 - &u) < g.row_index_.size()); // in row_index_ bounds?
assert(static_cast<size_t>(u2 - &u) < g.row_index_.size()); // in row_index_ bounds?
assert(static_cast<size_t>(u.index) <= g.col_index_.size() &&
static_cast<size_t>(u2->index) <= g.col_index_.size()); // in col_index_ bounds?
return edges_type(g.col_index_.begin() + u.index, g.col_index_.begin() + u2->index);
Expand All @@ -774,7 +774,7 @@ class compressed_graph_base
tag_invoke(::std::graph::tag_invoke::edges_fn_t, const graph_type& g, const vertex_type& u) {
static_assert(ranges::contiguous_range<row_index_vector>, "row_index_ must be a contiguous range to get next row");
const vertex_type* u2 = &u + 1;
assert(static_cast<size_t>(u2 - &u) < g.row_index_.size()); // in row_index_ bounds?
assert(static_cast<size_t>(u2 - &u) < g.row_index_.size()); // in row_index_ bounds?
assert(static_cast<size_t>(u.index) <= g.col_index_.size() &&
static_cast<size_t>(u2->index) <= g.col_index_.size()); // in col_index_ bounds?
return const_edges_type(g.col_index_.begin() + u.index, g.col_index_.begin() + u2->index);
Expand Down
4 changes: 2 additions & 2 deletions include/graph/container/dynamic_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,7 @@ class dynamic_graph_base {
constexpr typename vertices_type::value_type& operator[](size_type i) noexcept { return vertices_[i]; }
constexpr const typename vertices_type::value_type& operator[](size_type i) const noexcept { return vertices_[i]; }

public: // Operations
public: // Operations
void reserve_vertices(size_type count) {
if constexpr (reservable<vertices_type>) // reserve if we can; otherwise ignored
vertices_.reserve(count);
Expand Down Expand Up @@ -1633,7 +1633,7 @@ class dynamic_graph : public dynamic_graph_base<EV, VV, GV, VId, Sourced, Traits
private:
value_type value_; ///< Graph value

private: // tag_invoke properties
private: // tag_invoke properties
friend constexpr value_type& tag_invoke(::std::graph::tag_invoke::graph_value_fn_t, graph_type& g) {
return g.value_;
}
Expand Down
47 changes: 23 additions & 24 deletions include/graph/detail/graph_cpo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ namespace _Find_vertex {
};

template <class _G, class _UnCV>
concept _Has_ADL = _Has_class_or_enum_type<_G> //
concept _Has_ADL = _Has_class_or_enum_type<_G> //
&& requires(_G&& __g, const vertex_id_t<_G>& uid) {
{ _Fake_copy_init(find_vertex(__g, uid)) }; // intentional ADL
};
Expand Down Expand Up @@ -480,18 +480,18 @@ using edge_reference_t = ranges::range_reference_t<vertex_edge_range_t<G>>;
// Graph data structure must define
//
namespace _Target_id {
# if defined(__clang__) || defined(__EDG__) // TRANSITION, VSO-1681199
void target_id() = delete; // Block unqualified name lookup
# else // ^^^ no workaround / workaround vvv
# if defined(__clang__) || defined(__EDG__) // TRANSITION, VSO-1681199
void target_id() = delete; // Block unqualified name lookup
# else // ^^^ no workaround / workaround vvv
void target_id();
# endif // ^^^ workaround ^^^
# endif // ^^^ workaround ^^^

template <class _G, class _UnCV>
concept _Has_ref_member = requires(_G&& __g, edge_reference_t<_G> uv) {
{ _Fake_copy_init(uv.target_id(__g)) };
};
template <class _G, class _UnCV>
concept _Has_ref_ADL = _Has_class_or_enum_type<_G> //
concept _Has_ref_ADL = _Has_class_or_enum_type<_G> //
&& requires(_G&& __g, const edge_reference_t<_G>& uv) {
{ _Fake_copy_init(target_id(__g, uv)) }; // intentional ADL
};
Expand Down Expand Up @@ -543,8 +543,7 @@ namespace _Target_id {
} else if constexpr (_Strat_ref == _St_ref::_Non_member) {
return target_id(__g, uv); // intentional ADL
} else {
static_assert(_Always_false<_G>,
"target_id(g,uv) or g.target_id(uv) is not defined");
static_assert(_Always_false<_G>, "target_id(g,uv) or g.target_id(uv) is not defined");
}
}
};
Expand Down Expand Up @@ -840,7 +839,7 @@ namespace _NumVertices {
{ _Fake_copy_init(__g.num_vertices(__g)) };
};
template <class _G, class _UnCV>
concept _Has_ref_ADL = _Has_class_or_enum_type<_G> //
concept _Has_ref_ADL = _Has_class_or_enum_type<_G> //
&& requires(_G&& __g) {
{ _Fake_copy_init(num_vertices(__g)) }; // intentional ADL
};
Expand All @@ -851,7 +850,7 @@ namespace _NumVertices {
};

template <class _G, class _UnCV>
concept _Has_id_ADL = _Has_class_or_enum_type<_G> //
concept _Has_id_ADL = _Has_class_or_enum_type<_G> //
&& requires(_G&& __g, partition_id_t<_G> pid) {
{ _Fake_copy_init(num_vertices(__g, pid)) }; // intentional ADL
};
Expand Down Expand Up @@ -926,7 +925,7 @@ namespace _NumVertices {
static_assert(_Strat_id == _St_id::_Auto_eval);

if constexpr (_Strat_id == _St_id::_Non_member) {
return num_vertices(__g, pid); // intentional ADL
return num_vertices(__g, pid); // intentional ADL
} else if constexpr (_Strat_id == _St_id::_Auto_eval) {
return ranges::size(vertices(__g, pid)); // default impl
} else {
Expand Down Expand Up @@ -954,7 +953,7 @@ namespace _NumVertices {
if constexpr (_Strat_id == _St_ref::_Member) {
return __g.num_vertices();
} else if constexpr (_Strat_id == _St_ref::_Non_member) {
return num_vertices(__g); // intentional ADL
return num_vertices(__g); // intentional ADL
} else if constexpr (_Strat_id == _St_ref::_Auto_eval) {
return ranges::size(vertices(__g)); // default impl
} else {
Expand Down Expand Up @@ -1020,7 +1019,7 @@ namespace _Degree {
{ _Fake_copy_init(u.degree(__g)) };
};
template <class _G, class _UnCV>
concept _Has_ref_ADL = _Has_class_or_enum_type<_G> //
concept _Has_ref_ADL = _Has_class_or_enum_type<_G> //
&& requires(_G&& __g, const vertex_reference_t<_G>& u) {
{ _Fake_copy_init(degree(__g, u)) }; // intentional ADL
};
Expand All @@ -1031,7 +1030,7 @@ namespace _Degree {
};

template <class _G, class _UnCV>
concept _Has_id_ADL = _Has_class_or_enum_type<_G> //
concept _Has_id_ADL = _Has_class_or_enum_type<_G> //
&& requires(_G&& __g, const vertex_id_t<_G>& uid) {
{ _Fake_copy_init(degree(__g, uid)) }; // intentional ADL
};
Expand Down Expand Up @@ -1108,7 +1107,7 @@ namespace _Degree {
if constexpr (_Strat_ref == _St_ref::_Member) {
return u.degree(__g);
} else if constexpr (_Strat_ref == _St_ref::_Non_member) {
return degree(__g, u); // intentional ADL
return degree(__g, u); // intentional ADL
} else if constexpr (_Strat_ref == _St_ref::_Auto_eval) {
return ranges::size(edges(__g, u)); // default impl
} else {
Expand Down Expand Up @@ -1136,7 +1135,7 @@ namespace _Degree {
constexpr _St_id _Strat_id = _Choice_id<_G&>._Strategy;

if constexpr (_Strat_id == _St_id::_Non_member) {
return degree(__g, uid); // intentional ADL
return degree(__g, uid); // intentional ADL
} else if constexpr (_Strat_id == _St_id::_Auto_eval) {
return ranges::size(edges(__g, uid)); // default impl
} else {
Expand Down Expand Up @@ -1406,7 +1405,7 @@ namespace _Partition_vertex_id {
};

template <class _G>
concept _Has_UId_ADL = _Has_class_or_enum_type<_G> //
concept _Has_UId_ADL = _Has_class_or_enum_type<_G> //
&& requires(_G&& __g, vertex_id_t<_G> uid) {
{ _Fake_copy_init(partition_vertex_id(__g, uid)) }; // intentional ADL
};
Expand All @@ -1417,7 +1416,7 @@ namespace _Partition_vertex_id {
};

template <class _G>
concept _Has_UIter_ADL = _Has_class_or_enum_type<_G> //
concept _Has_UIter_ADL = _Has_class_or_enum_type<_G> //
&& requires(_G&& __g, vertex_iterator_t<_G> ui) {
{ _Fake_copy_init(partition_vertex_id(__g, ui)) }; // intentional ADL
};
Expand Down Expand Up @@ -1524,7 +1523,7 @@ namespace _Partition_vertex_id {
if constexpr (_Strat == _StIter::_Member) {
return __g.partition_vertex_id(ui);
} else if constexpr (_Strat == _StIter::_Non_member) {
return partition_vertex_id(__g, ui); // intentional ADL
return partition_vertex_id(__g, ui); // intentional ADL
} else {
return (*this)(__g, vertex_id(__g, ui)); // use partition_vertex_id(g, vertex_id(g,ui))
}
Expand Down Expand Up @@ -1554,7 +1553,7 @@ namespace _Find_partition_vertex {
};

template <class _G>
concept _Has_UId_ADL = _Has_class_or_enum_type<_G> //
concept _Has_UId_ADL = _Has_class_or_enum_type<_G> //
&& requires(_G&& __g, partition_vertex_id_t<_G> puid) {
{ _Fake_copy_init(find_partition_vertex(__g, puid)) }; // intentional ADL
};
Expand Down Expand Up @@ -1711,7 +1710,7 @@ namespace _Partition_target_id {
};

template <class _G>
concept _Has_UVRef__ADL = _Has_class_or_enum_type<_G> //
concept _Has_UVRef__ADL = _Has_class_or_enum_type<_G> //
&& requires(_G&& __g, edge_reference_t<_G> uv) {
{ _Fake_copy_init(partition_target_id(__g, uv)) }; // intentional ADL
};
Expand Down Expand Up @@ -1767,7 +1766,7 @@ namespace _Partition_target_id {
if constexpr (_Strat == _StRef::_Member) {
return __g.partition_target_id(uv);
} else if constexpr (_Strat == _StRef::_Non_member) {
return partition_target_id(__g, uv); // intentional ADL
return partition_target_id(__g, uv); // intentional ADL
} else {
return partition_vertex_id_t<_G>{0, target_id(__g, uv)}; // assume 1 partition with all vertices
}
Expand Down Expand Up @@ -1797,7 +1796,7 @@ namespace _Partition_source_id {
};

template <class _G>
concept _Has_UVRef__ADL = _Has_class_or_enum_type<_G> //
concept _Has_UVRef__ADL = _Has_class_or_enum_type<_G> //
&& requires(_G&& __g, edge_reference_t<_G> uv) {
{ _Fake_copy_init(partition_source_id(__g, uv)) }; // intentional ADL
};
Expand Down Expand Up @@ -1853,7 +1852,7 @@ namespace _Partition_source_id {
if constexpr (_Strat == _StRef::_Member) {
return __g.partition_source_id(uv);
} else if constexpr (_Strat == _StRef::_Non_member) {
return partition_source_id(__g, uv); // intentional ADL
return partition_source_id(__g, uv); // intentional ADL
} else {
return partition_vertex_id_t<_G>{0, source_id(__g, uv)}; // assume 1 partition with all vertices
}
Expand Down
2 changes: 1 addition & 1 deletion include/graph/graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ inline constexpr bool is_sourced_edge_v = is_sourced_edge<G, E>::value;
*
* @tparam G The graph type.
*/
template<class G>
template <class G>
concept index_adjacency_list = vertex_range<G> && targeted_edge<G, edge_t<G>> && requires(G&& g, vertex_id_t<G> uid) {
{ edges(g, uid) } -> ranges::forward_range;
};
Expand Down
6 changes: 3 additions & 3 deletions include/graph/views/edgelist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
//
// edgelist(g,uid) -> edge_descriptor<VId,true,E,void> -> {source_id, target_id, edge&}
// edgelist(g,uid,evf) -> edge_descriptor<VId,true,E,EV> -> {source_id, target_id, edge&, value}
//
//
// basic_edgelist(g) -> edge_descriptor<VId,true,void,void> -> {source_id, target_id}
//
// basic_edgelist(g,uid) -> edge_descriptor<VId,true,void,void> -> {source_id, target_id}
//
//
// given: auto evf = [&g](edge_reference_t<G> uv) { return edge_value(uv); }
//
// vertex_id<G> first_id = ..., last_id = ...;
Expand All @@ -23,7 +23,7 @@
// for([uid, vid, uv, value] : edgelist(g,first_id,last_id,evf))
//
// for([uid, vid] : basic_edgelist(g))
//
//
// for([uid, vid] : basic_edgelist(g,uid))
//
namespace std::graph::views {
Expand Down
2 changes: 1 addition & 1 deletion include/graph/views/incidence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
// incidence(g,uid) -> edge_descriptor<VId,false,E,EV> -> {target_id, edge&}
// incidence(g,uid,evf) -> edge_descriptor<VId,false,E,EV> -> {target_id, edge&, value}
//
//
// basic_incidence(g,uid,evf) -> edge_descriptor<VId,false,void,void> -> {target_id}
//
// given: auto evf = [&g](edge_reference_t<G> uv) { return edge_value(g,uv) };
Expand Down
6 changes: 3 additions & 3 deletions include/graph/views/neighbors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
//
// neighbors(g,uid) -> neighbor_descriptor<VId,false,E,VV> -> {target_id, vertex&}
// neighbors(g,uid,vvf) -> neighbor_descriptor<VId,false,E,VV> -> {target_id, vertex&, value]}
//
//
// basic_neighbors(g,uid) -> neighbor_descriptor<VId,false,void,EV> -> {target_id}
//
// given: auto vvf = [&g](vertex_reference_t<G> v) { return vertex_value(g,v); }
//
// examples: for([vid, v] : neighbors(g,uid))
// for([vid, v, value] : neighbors(g,uid,vvf))
//
//
// for([vid] : basic_neighbors(g,uid))
//
// Since uid is passed to neighbors(), there's no need to include Sourced versions of
// incidence().
// basic_neighbors(g,uid) is the same as basic_incidence(g,uid). It is retained for
// basic_neighbors(g,uid) is the same as basic_incidence(g,uid). It is retained for
// symmatry and to avoid confusion.
//
namespace std::graph {
Expand Down
2 changes: 1 addition & 1 deletion tests/csv_routes_csr_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ TEST_CASE("Germany routes CSV+csr test", "[csv][csr][germany]") {
cout << "\n" << test_name << "\n----------------------------------------" << endl << routes_graph(g) << endl;
int x = 0; // results are identifcal with csv_routes_dov_tests

//Germany Routes using compressed_graph
//Germany Routes using compressed_graph
//----------------------------------------
//[0 Frankfürt]
// --> [1 Mannheim] 85km
Expand Down

0 comments on commit 95f3c4d

Please sign in to comment.