Returns the index of a randomly chosen edge in *edges. Requires *edges be non-empty.
| 181 | // Returns the index of a randomly chosen edge in *edges. |
| 182 | // Requires *edges be non-empty. |
| 183 | static int RandomEdge(std::mt19937 *rnd, Edges *edges) { |
| 184 | std::uniform_int_distribution<int> distribution(0, edges->size() - 1); |
| 185 | return distribution(*rnd); |
| 186 | } |
| 187 | |
| 188 | // Returns the index of edge (from, to) in *edges or -1 if it is not in *edges. |
| 189 | static int EdgeIndex(Edges *edges, int from, int to) { |