22 template<
typename TGraph>
25 randomGraph(
unsigned long max_nodes,
unsigned long branching_factor);
29 template<
typename TGraph>
33 unsigned long branching_factor,
42template<
typename TGraph>
45 unsigned long branching_factor) {
46 using node_type =
typename TGraph::node_type;
50 std::default_random_engine e1(r());
53 std::uniform_int_distribution<unsigned long> number_of_nodes(1, max_nodes);
54 std::uniform_int_distribution<unsigned long>
55 number_of_edges(1, branching_factor);
57 unsigned long node_cnt = number_of_nodes(e1);
59 std::uniform_int_distribution<node_type> node_id(0, node_cnt * 10);
60 std::uniform_int_distribution<long> random_node(0, node_cnt - 1);
68 node_type
start(node_id(e1));
69 node_type goal(node_id(e1));
70 nodes.push_back(
start);
72 nodes.push_back(goal);
76 for (
unsigned long i = 0;
i < node_cnt; ++
i) {
77 node_type
node(node_id(e1));
79 nodes.push_back(
node);
83 for (
const auto &v : nodes) {
84 unsigned long cnt = number_of_edges(e1);
85 for (
unsigned long i = 0;
i < cnt; ++
i) {
86 long w = random_node(e1);
87 graph.addEdge(v, nodes.at(w));
96template<
typename TGraph>
99 unsigned long max_nodes,
100 unsigned long branching_factor,
102 using node_type =
typename TGraph::node_type;
103 using weight_type =
typename TGraph::edge_type::weight_type;
106 std::random_device r;
107 std::default_random_engine e1(r());
110 std::uniform_int_distribution<unsigned long> number_of_nodes(1, max_nodes);
111 std::uniform_int_distribution<unsigned long>
112 number_of_edges(1, branching_factor);
113 std::uniform_real_distribution<weight_type> edge_weight(1, max_weight);
115 unsigned long node_cnt = number_of_nodes(e1);
117 std::uniform_int_distribution<node_type> node_id(0, node_cnt * 10);
118 std::uniform_int_distribution<long> random_node(0, node_cnt - 1);
126 node_type
start(node_id(e1));
127 node_type goal(node_id(e1));
128 nodes.push_back(
start);
130 nodes.push_back(goal);
134 for (
unsigned long i = 0;
i < node_cnt; ++
i) {
135 node_type
node(node_id(e1));
137 nodes.push_back(
node);
141 for (
const auto &v : nodes) {
142 unsigned long cnt = number_of_edges(e1);
143 for (
unsigned long i = 0;
i < cnt; ++
i) {
144 long w = random_node(e1);
145 graph.addEdge(v, nodes.at(w), edge_weight(e1));
Class extending the tuple class from the standard library. Original reason is to allow printing of th...
Definition: tuple.hpp:42
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
Definition: RandomGraphFactory.hpp:19
static ext::tuple< TGraph, typename TGraph::node_type, typename TGraph::node_type > randomGraph(unsigned long max_nodes, unsigned long branching_factor)
Definition: RandomGraphFactory.hpp:44
static ext::tuple< TGraph, typename TGraph::node_type, typename TGraph::node_type > randomWeightedGraph(unsigned long max_nodes, unsigned long branching_factor, long max_weight)
Definition: RandomGraphFactory.hpp:98
int i
Definition: AllEpsilonClosure.h:118
constexpr auto make_tuple(Elements &&... args)
Helper of extended tuple construction. The tuple is constructed from values pack, types are deduced.
Definition: tuple.hpp:203
Definition: ReconstructPath.hpp:14
void start(measurements::stealth_string name, measurements::Type type)
Definition: measurements.cpp:14