2 //randomGraph(i,j) gives a random graph on i nodes and j edges.
6 //#include <list_graph.h>
7 //#include <time_measure.h>
8 //#include <for_each_macros.h>
9 //#include <bfs_iterator.h>
10 //#include <bipartite_graph_wrapper.h>
12 //#include <max_flow.h>
18 * Inicializalja a veletlenszamgeneratort.
19 * Figyelem, ez nem jo igazi random szamokhoz,
20 * erre ne bizzad a titkaidat!
24 unsigned int seed = getpid();
33 * Egy veletlen int-et ad vissza 0 es m-1 kozott.
37 return int( double(m) * rand() / (RAND_MAX + 1.0) );
41 template<typename Graph>
42 void randomGraph (Graph& g, int n, int m) {
43 typedef typename Graph::Node Node;
45 std::vector<Node> nodes;
46 for (int i=0; i<n; ++i)
47 nodes.push_back(g.addNode());
48 for (int i=0; i<m; ++i)
49 g.addEdge(nodes[random(n)], nodes[random(n)]);