Skip to content

Commit dd4764c

Browse files
committed
Apply recommended changes by Copilot to dynamic_graph
1 parent 320c8d8 commit dd4764c

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

include/graph/container/dynamic_graph.hpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ using dynamic_adjacency_graph = dynamic_graph<typename Traits::edge_value_type,
190190
* This is one of three composable classes used to define properties for a @c dynamic_edge, the
191191
* others being dynamic_edge_source for the source id and dynamic_edge_value for an edge value.
192192
*
193-
* Unlike the other composable edge property classes, this class doesn't have an open for not
193+
* Unlike the other composable edge property classes, this class doesn't have an option for not
194194
* existing. The target id always exists. It could easily be merged into the dynamic_edge class,
195-
* but was kept separate for design symmatry with the other property classes.
195+
* but was kept separate for design symmetry with the other property classes.
196196
*
197197
* @tparam EV The edge value type. If "void" is used no user value is stored on the edge and
198198
* calls to @c edge_value(g,uv) will generate a compile error.
@@ -299,7 +299,7 @@ class dynamic_edge_source {
299299
friend constexpr vertex_type& source(graph_type& g, edge_type& uv) noexcept {
300300
return begin(vertices(g))[uv.source_id_];
301301
}
302-
friend constexpr const vertex_type& source_fn(const graph_type& g, const edge_type& uv) noexcept {
302+
friend constexpr const vertex_type& source(const graph_type& g, const edge_type& uv) noexcept {
303303
return begin(vertices(g))[uv.source_id_];
304304
}
305305
};
@@ -356,7 +356,7 @@ class dynamic_edge_value {
356356
using value_type = EV;
357357
using graph_type = dynamic_graph<EV, VV, GV, VId, Sourced, Traits>;
358358
using vertex_type = dynamic_vertex<EV, VV, GV, VId, Sourced, Traits>;
359-
using edge_type = dynamic_edge_value<EV, VV, GV, VId, Sourced, Traits>;
359+
using edge_type = dynamic_edge<EV, VV, GV, VId, Sourced, Traits>;
360360

361361
public:
362362
constexpr dynamic_edge_value(const value_type& value) : value_(value) {}
@@ -815,7 +815,7 @@ class dynamic_vertex<EV, void, GV, VId, Sourced, Traits>
815815
* No additional space is used if the edge value type (EV) or vertex value type (VV) is void.
816816
*
817817
* The partition function is intended to determine the partition id for a vertex id on constructors.
818-
* It has been added to assure the same interface as the compresssed_graph, but is not implemented
818+
* It has been added to assure the same interface as the compressed_graph, but is not implemented
819819
* at this time.
820820
*
821821
* @tparam EV The edge value type. If "void" is used no user value is stored on the edge and
@@ -1283,10 +1283,10 @@ class dynamic_graph_base {
12831283
friend constexpr vertices_type& vertices(dynamic_graph_base& g) { return g.vertices_; }
12841284
friend constexpr const vertices_type& vertices(const dynamic_graph_base& g) { return g.vertices_; }
12851285

1286-
friend auto num_edges(const dynamic_graph_base& g) { return g.edge_count_; }
1287-
friend bool has_edge(const dynamic_graph_base& g) { return g.edge_count_ > 0; }
1286+
friend constexpr auto num_edges(const dynamic_graph_base& g) { return g.edge_count_; }
1287+
friend constexpr bool has_edge(const dynamic_graph_base& g) { return g.edge_count_ > 0; }
12881288

1289-
friend vertex_id_type vertex_id(const dynamic_graph_base& g, typename vertices_type::const_iterator ui) {
1289+
friend constexpr vertex_id_type vertex_id(const dynamic_graph_base& g, typename vertices_type::const_iterator ui) {
12901290
return static_cast<vertex_id_type>(ui - g.vertices_.begin());
12911291
}
12921292

@@ -1308,7 +1308,7 @@ class dynamic_graph_base {
13081308

13091309
friend constexpr auto num_vertices(const dynamic_graph_base& g, partition_id_type pid) {
13101310
assert(static_cast<size_t>(pid) < g.partition_.size() - 1);
1311-
g.partition_[pid + 1] - g.partition_[pid];
1311+
return g.partition_[pid + 1] - g.partition_[pid];
13121312
}
13131313

13141314
friend constexpr auto vertices(const dynamic_graph_base& g, partition_id_type pid) {
@@ -1340,7 +1340,7 @@ class dynamic_graph_base {
13401340
* used as a key to find a vertex in the vertices container.
13411341
*
13421342
* The partition function is intended to determine the partition id for a vertex id on constructors.
1343-
* It has been added to assure the same interface as the compresssed_graph, but is not implemented
1343+
* It has been added to assure the same interface as the compressed_graph, but is not implemented
13441344
* at this time.
13451345
*
13461346
* @tparam EV @showinitializer =void The edge value type. If "void" is used no user value is stored on the edge
@@ -1521,14 +1521,14 @@ class dynamic_graph : public dynamic_graph_base<EV, VV, GV, VId, Sourced, Traits
15211521
*/
15221522
template <class ERng, class EProj, class VRng, forward_range PartRng, class VProj = identity>
15231523
requires convertible_to<range_value_t<PartRng>, VId>
1524-
dynamic_graph(const ERng& erng,
1524+
dynamic_graph(GV&& gv,
1525+
const ERng& erng,
15251526
const VRng& vrng,
15261527
EProj eproj,
15271528
VProj vproj,
1528-
GV&& gv,
15291529
const PartRng& partition_start_ids = std::vector<VId>(),
15301530
allocator_type alloc = allocator_type())
1531-
: base_type(erng, vrng, eproj, vproj, partition_start_ids, alloc), value_(move(gv)) {}
1531+
: base_type(erng, vrng, eproj, vproj, partition_start_ids, alloc), value_(std::move(gv)) {}
15321532

15331533

15341534
// max_vertex_id, erng, eproj, alloc
@@ -1539,7 +1539,7 @@ class dynamic_graph : public dynamic_graph_base<EV, VV, GV, VId, Sourced, Traits
15391539
* @brief Construct the graph given the maximum vertex id and edge data range.
15401540
*
15411541
* The vertices container is pre-extended to accomodate the number of vertices referenced by edges and avoids
1542-
* the need to scan the edges to determine the maximum vertex id.
1542+
* the need to scan the edges to determine the maximum vertex id.
15431543
*
15441544
* The graph value is default-constructed.
15451545
*
@@ -1752,7 +1752,7 @@ class dynamic_graph : public dynamic_graph_base<EV, VV, GV, VId, Sourced, Traits
17521752
* See the dynamic_graph description for more information about this class.
17531753
*
17541754
* The partition function is intended to determine the partition id for a vertex id on constructors.
1755-
* It has been added to assure the same interface as the compresssed_graph, but is not implemented
1755+
* It has been added to assure the same interface as the compressed_graph, but is not implemented
17561756
* at this time.
17571757
*
17581758
* @tparam EV @showinitializer =void The edge value type. If "void" is used no user value is stored on the edge

0 commit comments

Comments
 (0)