Skip to content

Commit 0a130e7

Browse files
lums658claude
andcommitted
Standardize docstrings to JavaDoc style and fix @param mismatches
Documentation style: - Convert all /// style comments to /** */ JavaDoc style - Standardize @param, @tparam, @return tag formatting @param fixes: - prim.hpp: Add missing @param weight - build.hpp: Fix comma format in @param tags - betweenness_centrality.hpp: @param G -> @param graph - jaccard.hpp: @param G -> @param A - triangle_count.hpp: Add @param threads - atomic.hpp: Fix @param[in/out] -> @param[in,out] - disjoint_set.hpp: Fix multiple parameter name mismatches Files converted to /** */ style: - atomic.hpp, triangle_count.hpp, util.hpp - intersection_size.hpp, make_priority_queue.hpp - parallel_for.hpp, experimental/triangle_count.hpp - cyclic_neighbor_range.hpp, cyclic_range_adaptor.hpp 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent be0e44d commit 0a130e7

File tree

14 files changed

+620
-550
lines changed

14 files changed

+620
-550
lines changed

include/nwgraph/adaptors/cyclic_neighbor_range.hpp

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,26 @@
1919

2020
namespace nw {
2121
namespace graph {
22-
/// The cyclic neighbor range adapter.
23-
///
24-
/// This adapter takes an underlying random access range and provides the
25-
/// ability to split the range into cycles for TBB. A cycle is a subset of the
26-
/// range such that each subsequent element is some stride from the previous
27-
/// element.
28-
///
29-
/// The cyclic range adapter is implemented recursively, that is that each time
30-
/// the range is split it simply returns two ranges that cover the previous
31-
/// range, each with twice the cycle and one offset by one element.
32-
///
33-
/// Key to the adapter is the _cutoff_, which is defined in terms of the maximum
34-
/// stride rather than in terms of the number of elements. A _cutoff_ of `1`
35-
/// implies that the range can't be split, while a `_cutoff_` of `n` means that
36-
/// the range can be split into up to `n` cycles.
37-
///
38-
/// @tparam Iterator The type of the underlying range iterator (must be at
39-
/// least random access).
22+
/**
23+
* The cyclic neighbor range adapter.
24+
*
25+
* This adapter takes an underlying random access range and provides the
26+
* ability to split the range into cycles for TBB. A cycle is a subset of the
27+
* range such that each subsequent element is some stride from the previous
28+
* element.
29+
*
30+
* The cyclic range adapter is implemented recursively, that is that each time
31+
* the range is split it simply returns two ranges that cover the previous
32+
* range, each with twice the cycle and one offset by one element.
33+
*
34+
* Key to the adapter is the _cutoff_, which is defined in terms of the maximum
35+
* stride rather than in terms of the number of elements. A _cutoff_ of `1`
36+
* implies that the range can't be split, while a `_cutoff_` of `n` means that
37+
* the range can be split into up to `n` cycles.
38+
*
39+
* @tparam Iterator The type of the underlying range iterator (must be at
40+
* least random access).
41+
*/
4042
template <class Iterator>
4143
class cyclic_neighbor_range {
4244
static_assert(std::is_base_of_v<std::random_access_iterator_tag, typename std::iterator_traits<Iterator>::iterator_category>);
@@ -83,17 +85,19 @@ class cyclic_neighbor_range {
8385
}
8486
};
8587

86-
/// Return an iterator that points to the start of the cycle.
88+
/** Return an iterator that points to the start of the cycle. */
8789
iterator begin() const {
8890
return { begin_, begin_ + cycle_, stride_ };
8991
}
9092

91-
/// Return an iterator that points to the end of the cycle.
92-
///
93-
/// The end of the cycle is the first iterator in the cycle that is greater
94-
/// than or equal to the end_ iterator in the underlying range. End iterators
95-
/// for different cycles will be different even if the underlying range and
96-
/// strides match, so tests should not be performed across cycles.
93+
/**
94+
* Return an iterator that points to the end of the cycle.
95+
*
96+
* The end of the cycle is the first iterator in the cycle that is greater
97+
* than or equal to the end_ iterator in the underlying range. End iterators
98+
* for different cycles will be different even if the underlying range and
99+
* strides match, so tests should not be performed across cycles.
100+
*/
97101
iterator end() const {
98102
difference_type n = end_ - begin_ - cycle_; // shifted span for cycle
99103
difference_type r = n % stride_; // remainder in last stride
@@ -112,10 +116,12 @@ class cyclic_neighbor_range {
112116
return size() == 0;
113117
}
114118

115-
/// Runtime check to see if the range is divisible.
116-
///
117-
/// The range can be subdivided if its stride can be increased relative to the
118-
/// cutoff.
119+
/**
120+
* Runtime check to see if the range is divisible.
121+
*
122+
* The range can be subdivided if its stride can be increased relative to the
123+
* cutoff.
124+
*/
119125
bool is_divisible() const {
120126
return stride_ <= cutoff_;
121127
}

include/nwgraph/adaptors/cyclic_range_adaptor.hpp

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,17 @@
1919

2020
namespace nw {
2121
namespace graph {
22-
/// stride rather than in terms of the number of elements. A _cutoff_ of `1`
23-
/// implies that the range can't be split, while a `_cutoff_` of `n` means that
24-
/// the range can be split into up to `n` cycles.
25-
///
26-
/// @tparam Iterator The type of the underlying range iterator (must be at
27-
/// least random access).
22+
/**
23+
* The cyclic range adapter.
24+
*
25+
* Key to the adapter is the _cutoff_, which is defined in terms of the maximum
26+
* stride rather than in terms of the number of elements. A _cutoff_ of `1`
27+
* implies that the range can't be split, while a `_cutoff_` of `n` means that
28+
* the range can be split into up to `n` cycles.
29+
*
30+
* @tparam Iterator The type of the underlying range iterator (must be at
31+
* least random access).
32+
*/
2833
template <class Iterator>
2934
class cyclic_range_adaptor {
3035
static_assert(std::is_base_of_v<std::random_access_iterator_tag, typename std::iterator_traits<Iterator>::iterator_category>);
@@ -70,17 +75,19 @@ class cyclic_range_adaptor {
7075
}
7176
};
7277

73-
/// Return an iterator that points to the start of the cycle.
78+
/** Return an iterator that points to the start of the cycle. */
7479
iterator begin() const {
7580
return { begin_ + cycle_, stride_ };
7681
}
7782

78-
/// Return an iterator that points to the end of the cycle.
79-
///
80-
/// The end of the cycle is the first iterator in the cycle that is greater
81-
/// than or equal to the end_ iterator in the underlying range. End iterators
82-
/// for different cycles will be different even if the underlying range and
83-
/// strides match, so tests should not be performed across cycles.
83+
/**
84+
* Return an iterator that points to the end of the cycle.
85+
*
86+
* The end of the cycle is the first iterator in the cycle that is greater
87+
* than or equal to the end_ iterator in the underlying range. End iterators
88+
* for different cycles will be different even if the underlying range and
89+
* strides match, so tests should not be performed across cycles.
90+
*/
8491
iterator end() const {
8592
difference_type n = end_ - begin_ - cycle_; // shifted span for cycle
8693
difference_type r = n % stride_; // remainder in last stride
@@ -99,10 +106,12 @@ class cyclic_range_adaptor {
99106
return size() == 0;
100107
}
101108

102-
/// Runtime check to see if the range is divisible.
103-
///
104-
/// The range can be subdivided if its stride can be increased relative to the
105-
/// cutoff.
109+
/**
110+
* Runtime check to see if the range is divisible.
111+
*
112+
* The range can be subdivided if its stride can be increased relative to the
113+
* cutoff.
114+
*/
106115
bool is_divisible() const {
107116
return stride_ <= cutoff_;
108117
}

include/nwgraph/algorithms/betweenness_centrality.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,12 @@ std::vector<score_t> brandes_bc(const Graph& G, bool normalize = true) {
207207
* @tparam accum_t Type of path counts.
208208
* @tparam OuterExecutionPolicy Parallel execution policy type for outer loop of algorithm. Default: std::execution::parallel_unsequenced_policy
209209
* @tparam InnerExecutionPolicy Parallel execution policy type for inner loop of algorithm. Default: std::execution::parallel_unsequenced_policy
210-
* @param G Input graph.
211-
* @param normalize Flag indicating whether to normalize centrality scores relative to largest score.
210+
* @param graph Input graph.
212211
* @param sources Vector of starting sources.
212+
* @param threads Number of threads being used in computation. Used to compute number of bins in computation.
213213
* @param outer_policy Outer loop parallel execution policy.
214214
* @param inner_policy Inner loop parallel execution policy.
215-
* @param threads Number of threads being used in computation. Used to compute number of bins in computation.
215+
* @param normalize Flag indicating whether to normalize centrality scores relative to largest score.
216216
* @return Vector of centrality for each vertex.
217217
*/
218218
template <class score_t, class accum_t, adjacency_list_graph Graph, class OuterExecutionPolicy = std::execution::parallel_unsequenced_policy,
@@ -336,11 +336,11 @@ auto brandes_bc(const Graph& graph, const std::vector<typename Graph::vertex_id_
336336
* @tparam accum_t Type of path counts.
337337
* @tparam OuterExecutionPolicy Parallel execution policy type for outer loop of algorithm. Default: std::execution::parallel_unsequenced_policy
338338
* @tparam InnerExecutionPolicy Parallel execution policy type for inner loop of algorithm. Default: std::execution::parallel_unsequenced_policy
339-
* @param G Input graph.
340-
* @param normalize Flag indicating whether to normalize centrality scores relative to largest score.
339+
* @param graph Input graph.
340+
* @param threads Number of threads being used in computation. Used to compute number of bins in computation.
341341
* @param outer_policy Outer loop parallel execution policy.
342342
* @param inner_policy Inner loop parallel execution policy.
343-
* @param threads Number of threads being used in computation. Used to compute number of bins in computation.
343+
* @param normalize Flag indicating whether to normalize centrality scores relative to largest score.
344344
* @return Vector of centrality for each vertex.
345345
*/
346346
template <class score_t, class accum_t, adjacency_list_graph Graph, class OuterExecutionPolicy = std::execution::parallel_unsequenced_policy,

include/nwgraph/algorithms/prim.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ namespace graph {
3232
* @tparam Weight A weight function for a given edge, returns a Distance.
3333
* @param graph Input graph.
3434
* @param source Starting vertex.
35+
* @param weight Weight function that returns the edge weight.
3536
* @return std::vector<vertex_id_t<Graph>>, the predecessor list (the MST).
3637
*/
3738
template <adjacency_list_graph Graph, class Distance, class Weight>

include/nwgraph/algorithms/triangle_count.hpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,19 @@ size_t triangle_count(const GraphT& A) {
5555
return triangles;
5656
}
5757

58-
/// Parallel triangle counting using `std::async`.
59-
///
60-
/// This version of triangle counting uses `threads` `std::async` launches to
61-
/// evaluate the passed `op` in parallel. The `op` will be provided the thread
62-
/// id, but should capture any other information required to perform the
63-
/// decomposed work.
64-
///
65-
/// @tparam Op The type of the decomposed work.
66-
///
67-
/// @param op The decomposed work for each `std::async`.
68-
///
69-
/// @return The += reduced total of counted triangles.
58+
/**
59+
* @brief Parallel triangle counting using `std::async`.
60+
*
61+
* This version of triangle counting uses `threads` `std::async` launches to
62+
* evaluate the passed `op` in parallel. The `op` will be provided the thread
63+
* id, but should capture any other information required to perform the
64+
* decomposed work.
65+
*
66+
* @tparam Op The type of the decomposed work.
67+
* @param threads Number of threads to use for parallel execution.
68+
* @param op The decomposed work for each `std::async`.
69+
* @return The += reduced total of counted triangles.
70+
*/
7071
template <class Op>
7172
std::size_t triangle_count_async(std::size_t threads, Op&& op) {
7273
// Launch the workers.

include/nwgraph/build.hpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -544,14 +544,14 @@ auto relabel(edge_list_t& el, const Vector& perm, ExecutionPolicy&& policy = {})
544544
/**
545545
* @brief This function relabels edge list of bipartite graph. It only relabels one endpoint.
546546
*
547-
* @tparam idx, which end point to relabel
548-
* @tparam edge_list_t, edge list type
549-
* @tparam Vector, permutation array type
550-
* @tparam ExecutionPolicy, execution polity type
551-
* @param el, edge list
552-
* @param perm, permutation array of the IDs of vertices
553-
* @param policy, excution policy
554-
* @return the new IDs of the vertices after permutation
547+
* @tparam idx Which end point to relabel.
548+
* @tparam edge_list_t Edge list type.
549+
* @tparam Vector Permutation array type.
550+
* @tparam ExecutionPolicy Execution policy type.
551+
* @param el Edge list.
552+
* @param perm Permutation array of the IDs of vertices.
553+
* @param policy Execution policy.
554+
* @return The new IDs of the vertices after permutation.
555555
*/
556556
template <int idx, edge_list_graph edge_list_t, class Vector, class ExecutionPolicy = default_execution_policy>
557557
requires(false == is_unipartite<typename edge_list_t::bipartite_graph_base>::value)
@@ -571,11 +571,11 @@ auto relabel(edge_list_t& el, const Vector& perm, ExecutionPolicy&& policy = {})
571571
/**
572572
* @brief This relabel function for edge list handles unipartite graph. It will relabel both endpoints.
573573
*
574-
* @tparam edge_list_t, edge list type
575-
* @tparam Vector, degree array type
576-
* @param el, edge list
577-
* @param direction, sort the degrees of vertices in which direction
578-
* @param degree, the degree array
574+
* @tparam edge_list_t Edge list type.
575+
* @tparam Vector Degree array type.
576+
* @param el Edge list.
577+
* @param direction Sort the degrees of vertices in which direction.
578+
* @param degree The degree array.
579579
*/
580580
template <edge_list_graph edge_list_t, class Vector = std::vector<int>>
581581
requires(is_unipartite<typename edge_list_t::unipartite_graph_base>::value)
@@ -590,13 +590,13 @@ void relabel_by_degree(edge_list_t& el, std::string direction = "ascending", con
590590
/**
591591
* @brief This function relabels edge list of either unipartite graph or bipartite graph.
592592
*
593-
* @tparam idx, which end point to relabel. Unipartite graph will ignore idx.
594-
* @tparam edge_list_t, edge list type
595-
* @tparam Vector, degree array type
596-
* @param el, edge list
597-
* @param direction, sort the degrees of vertices in which direction
598-
* @param degree, the degree array
599-
* @return the new IDs of the vertices after permutation
593+
* @tparam idx Which end point to relabel. Unipartite graph will ignore idx.
594+
* @tparam edge_list_t Edge list type.
595+
* @tparam Vector Degree array type.
596+
* @param el Edge list.
597+
* @param direction Sort the degrees of vertices in which direction.
598+
* @param degree The degree array.
599+
* @return The new IDs of the vertices after permutation.
600600
*/
601601
template <int idx, edge_list_graph edge_list_t, class Vector = std::vector<int>>
602602
requires(is_unipartite<typename edge_list_t::unipartite_graph_base>::value)

include/nwgraph/experimental/algorithms/jaccard.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ namespace graph {
3535
/**
3636
* @brief A sequential jaccard similarity algorithm using set intersection.
3737
* This version assumes each edge is a std::tuple<size_t, size_t, double>.
38-
*
39-
* @tparam GraphT Type of graph. Must meet the requirements of adjacency_list_graph concept.
40-
* @param G Input graph.
38+
*
39+
* @tparam GraphT Type of graph. Must meet the requirements of adjacency_list_graph concept.
40+
* @param A Input graph.
4141
* @return size_t Jaccard similarity score.
4242
*/
4343
template <typename GraphT>

0 commit comments

Comments
 (0)