Skip to content

Commit 06c9acb

Browse files
Add a multi key example and a keys parameter description to sort_edges_by_keys
1 parent 70a58f7 commit 06c9acb

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

libs/librrgraph/src/base/rr_graph_storage.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,8 +890,6 @@ class t_rr_graph_storage {
890890
/**
891891
* @brief Sorts edges by one or more small integer keys.
892892
*
893-
* keys are listed from the most significant to the least significant. Each key is a
894-
* vtr::sort_key whose key_of maps an RREdgeId to a value smaller than its num_keys.
895893
* The result is the same as a stable sort by the tuple of keys, ties keep their
896894
* current order, but it is computed with stable counting sort passes instead of a
897895
* comparison sort.
@@ -903,6 +901,16 @@ class t_rr_graph_storage {
903901
* Example, sorting by destination node:
904902
*
905903
* sort_edges_by_keys(vtr::sort_key(num_nodes, [&](RREdgeId e) { return edge_dest_node_[e]; }));
904+
*
905+
* Example, sorting by source node, and by destination node among edges that share
906+
* a source node:
907+
*
908+
* sort_edges_by_keys(vtr::sort_key(num_nodes, [&](RREdgeId e) { return edge_src_node_[e]; }),
909+
* vtr::sort_key(num_nodes, [&](RREdgeId e) { return edge_dest_node_[e]; }));
910+
*
911+
* @param keys One vtr::sort_key per sort criterion, listed from the most significant
912+
* to the least significant. Each is built with vtr::sort_key(num_keys, key_of),
913+
* where key_of maps an RREdgeId to a value smaller than num_keys.
906914
*/
907915
template <typename... KeyFns>
908916
void sort_edges_by_keys(const vtr::sort_key<KeyFns>&... keys) {

0 commit comments

Comments
 (0)