Skip to content

Commit 260b279

Browse files
committed
Apply Copilot recommended changes to the following files:
graph.hpp graph_cpo.hpp graph_using.hpp One bug was fixed in has_edge function in graph_cpo.hpp:
1 parent 0780f43 commit 260b279

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

include/graph/detail/graph_cpo.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ concept _el_index_tuple_edge = _el_tuple_edge<_E> && //
9797
integral<tuple_element_t<0, _E>>;
9898

9999
//
100-
// Suport the use of edge_info for edgelist edge definitions
100+
// Support the use of edge_info for edgelist edge definitions
101101
// (Only types and values needed from edge_info are used and there is no
102102
// explicit use of edge_info. This is deemed more flexible and no
103103
// functionality is compromised for it.)
@@ -1319,9 +1319,9 @@ namespace _Source {
13191319
* Complexity: O(1)
13201320
*
13211321
* Default implementation: *(begin(vertices(g)) + source_id(g, uv)),
1322-
# if @source_id(g,uv) is defined for G and random_access_range<vertex_range_t<G>>
1322+
* if @source_id(g,uv) is defined for G and random_access_range<vertex_range_t<G>>
13231323
*
1324-
* Not all graphs support a source on an edge. The existance of @c source_id(g,uv) function
1324+
* Not all graphs support a source on an edge. The existence of @c source_id(g,uv) function
13251325
* for a graph type G determines if it is considered a "sourced" edge or not. If it is,
13261326
* @c source(g,uv) will also exist.
13271327
*
@@ -2561,7 +2561,7 @@ namespace _HasEdge {
25612561
return has_edge(__g); // intentional ADL
25622562
} else if constexpr (_Strat_id == _St_ref::_Auto_eval) {
25632563
for (auto&& u : vertices(__g))
2564-
if (empty(edges(__g, u)))
2564+
if (!empty(edges(__g, u)))
25652565
return true;
25662566
return false;
25672567
} else {

include/graph/detail/graph_using.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
#include <tuple>
66
#include <functional>
77
#include <optional>
8+
#include <type_traits>
9+
#include <iterator>
10+
#include <algorithm>
11+
#include <memory>
812

913
namespace graph {
1014
// Containers are not included to avoid potential conflicts: vector, list, string, etc.
@@ -19,6 +23,8 @@ using std::forward_iterator_tag;
1923
using std::declval;
2024
using std::allocator;
2125
using std::allocator_traits;
26+
using std::unique_ptr;
27+
using std::shared_ptr;
2228

2329
using std::iter_difference_t;
2430
using std::iter_value_t;
@@ -40,7 +46,6 @@ using std::is_arithmetic_v;
4046
using std::is_convertible_v;
4147
using std::is_same_v;
4248
using std::is_invocable_v;
43-
using std::is_arithmetic_v;
4449
using std::is_void_v;
4550
using std::is_lvalue_reference_v;
4651
using std::is_signed_v;
@@ -52,6 +57,7 @@ using std::remove_reference_t;
5257
using std::remove_pointer_t;
5358
using std::remove_cvref_t;
5459
using std::invoke_result_t;
60+
using std::decay_t;
5561

5662
using std::false_type;
5763
using std::true_type;
@@ -62,6 +68,7 @@ using std::convertible_to;
6268
using std::integral;
6369
using std::invocable;
6470
using std::regular_invocable;
71+
using std::predicate;
6572

6673
// range concepts
6774
using std::ranges::range;
@@ -110,4 +117,6 @@ using std::ranges::empty;
110117
using std::tuple_cat;
111118
using std::max;
112119
using std::min;
120+
using std::swap;
121+
using std::is_sorted;
113122
} // namespace graph

include/graph/graph.hpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
* @defgroup graph_views Views / Adaptors
88
* @defgroup graph_containers Containers
99
* @defgroup graph_construction Graph Construction
10-
* @defgroup graph_io Graph I/O
10+
* @defgroup graph_io # ifdef ENABLE_EDGELIST_RANGE
11+
template <class ELR>
12+
concept basic_edgelist_range = std::ranges::forward_range<ELR> && std::negation_v<basic_adjacency_list<ELR>>;
13+
template <class ELR>
14+
concept edgelist_range = std::ranges::forward_range<ELR> && std::negation_v<adjacency_list<ELR>>;
15+
# endif Graph I/O
1116
* @defgroup graph_utilities Utilities
1217
*
1318
* @defgroup graph_concepts Graph Concepts
@@ -283,7 +288,7 @@ concept edgelist_range = ranges::forward_range<ELR> && negation_v<adjacency_list
283288

284289
/**
285290
* @ingroup graph_properties
286-
* @brief Concept for the existance of degree function for graph G.
291+
* @brief Concept for the existence of degree function for graph G.
287292
*
288293
* Returns true if degree(g) exists for graph G.
289294
*
@@ -300,7 +305,7 @@ concept has_degree = requires(G&& g, vertex_reference_t<G> u) {
300305

301306
/**
302307
* @ingroup graph_properties
303-
* @brief Concept for the existance of the find_vertex(g,uid) function for graph G.
308+
* @brief Concept for the existence of the find_vertex(g,uid) function for graph G.
304309
*
305310
* Returns true if find_vertex(g,uid) exists for graph G.
306311
*
@@ -313,7 +318,7 @@ concept has_find_vertex = requires(G&& g, vertex_id_t<G> uid) {
313318

314319
/**
315320
* @ingroup graph_properties
316-
* @brief Concept for the existance of the find_vertex_edge(g,uid,vid) function for graph G.
321+
* @brief Concept for the existence of the find_vertex_edge(g,uid,vid) function for graph G.
317322
*
318323
* Returns true if find_vertex_edge(g,u,vid) and find_vertex_edge(g,uid,vid) exists for graph G.
319324
*
@@ -327,7 +332,7 @@ concept has_find_vertex_edge = requires(G&& g, vertex_id_t<G> uid, vertex_id_t<G
327332

328333
/**
329334
* @ingroup graph_properties
330-
* @brief Concept for the existance of the has_contains_edge(g,uid,vid) function for graph G.
335+
* @brief Concept for the existence of the has_contains_edge(g,uid,vid) function for graph G.
331336
*
332337
* Returns true if has_contains_edge(g,uid,vid) exists for graph G.
333338
*
@@ -341,7 +346,7 @@ concept has_contains_edge = requires(G&& g, vertex_id_t<G> uid, vertex_id_t<G> v
341346

342347
/**
343348
* @ingroup graph_properties
344-
* @ brief Specializable to define that a graph type has unordered edges.
349+
* @brief Specializable to define that a graph type has unordered edges.
345350
*
346351
* Override for a graph type where source_id and target_id are unordered
347352
* on an edge so views and algorithms know to choose the correct target
@@ -362,7 +367,7 @@ concept has_contains_edge = requires(G&& g, vertex_id_t<G> uid, vertex_id_t<G> v
362367
* namespace my_namespace {
363368
* template <class T>
364369
* class my_graph { ... };
365-
* template class< T>
370+
* template <class T>
366371
* class my_edge { int src_id; int tgt_id; ... };
367372
* }
368373
* namespace graph {

0 commit comments

Comments
 (0)