# Changeset 558:4cbfb435ec2b in lemon-0.x

Ignore:
Timestamp:
05/06/04 19:22:11 (17 years ago)
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@731
Message:

random graph, random bipartite graph in jacint/graph_gen.h

Location:
src/work
Files:
3 edited

Unmodified
Added
Removed
• ## src/work/jacint/graph_gen.h

 r534 // -*- c++ -*- //randomGraph(i,j) gives a random graph on i nodes and j edges. #include #include //#include //#include //#include //#include //#include //#include //#include namespace hugo { /// Generates a random graph with n nodes and m edges. /// Before generating the random graph, \c g.clear() is called. template void randomGraph (Graph& g, int n, int m) { typedef typename Graph::Node Node; void randomGraph(Graph& g, int n, int m) { g.clear(); std::vector nodes; std::vector nodes; for (int i=0; i void randomBipartiteGraph(Graph& g, int a, int b, int m) { g.clear(); std::vector s_nodes; std::vector t_nodes; for (int i=0; i
• ## src/work/marci/bipartite_graph_wrapper.h

 r557 void clear() { FOR_EACH_LOC(typename Parent::EdgeIt, e, G) erase(e); FOR_EACH_LOC(typename Parent::NodeIt, n, G) erase(n); FOR_EACH_LOC(typename Parent::EdgeIt, e, *this) erase(e); FOR_EACH_LOC(typename Parent::NodeIt, n, *this) erase(n); } };
• ## src/work/marci/bipartite_matching_try_3.cc

 r555 #include #include #include #include #include #include #include using namespace hugo; }; /** * Inicializalja a veletlenszamgeneratort. * Figyelem, ez nem jo igazi random szamokhoz, * erre ne bizzad a titkaidat! */ void random_init() { unsigned int seed = getpid(); seed |= seed << 15; seed ^= time(0); srand(seed); } /** * Egy veletlen int-et ad vissza 0 es m-1 kozott. */ int random(int m) { return int( double(m) * rand() / (RAND_MAX + 1.0) ); } int main() { Graph g; std::vector s_nodes; std::vector t_nodes; int a; std::cout << "Generatig a random bipartite graph..." << std::endl; for (int i=0; i
Note: See TracChangeset for help on using the changeset viewer.