@@ -94,7 +94,7 @@ void stable_counting_sort(InIt first, InIt last, OutIt out, size_t num_keys, Key
9494}
9595
9696/* *
97- * @brief Stable counting sort of a container in place.
97+ * @brief Stable counting sort of a container in place, in ascending key order .
9898 *
9999 * scratch must be a different container of the same size as items. It is used
100100 * as the destination buffer and then swapped with items, so after the call
@@ -150,17 +150,24 @@ void stable_radix_sort_passes(Container& items, Container& scratch, const KeyTup
150150 * @brief Stable LSD radix sort of [first, last) into out by several keys.
151151 *
152152 * out must already have (last - first) elements. keys are listed from the
153- * most significant to the least significant. The result is the same as a
153+ * most significant to the least significant, and every key is sorted in
154+ * ascending order (lowest key first). The result is the same as a
154155 * std::stable_sort by the tuple of keys, but it is computed as one stable
155156 * counting sort pass per key, least significant key first. The input is read
156157 * directly, so a generated sequence such as a vtr::StrongIdRange needs no copy first.
157158 * As with stable_counting_sort, the input may hold at most 2^32 - 1 elements.
158159 *
159- * Example, sorting edges by (source node, destination node):
160+ * Example, sorting edges by ascending (source node, destination node):
160161 *
161162 * vtr::stable_radix_sort(edges.begin(), edges.end(), sorted_edges,
162163 * vtr::sort_key(num_nodes, [&](RREdgeId e) { return src_node[e]; }),
163164 * vtr::sort_key(num_nodes, [&](RREdgeId e) { return dest_node[e]; }));
165+ *
166+ * Afterwards sorted_edges starts with the edges of the lowest source node,
167+ * ordered from the lowest to the highest destination node, and so on for
168+ * each source node from lowest to highest. Edges with the same source and
169+ * destination keep the relative order they had in the input. There is no
170+ * option to sort highest first.
164171 */
165172template <typename InIt, typename Container, typename ... KeyFns>
166173 requires std::forward_iterator<InIt>
0 commit comments