static void yagi_random_graph(GraphType &g, size_t max_vertices, int vertex_time_limit, double edge_to_vertex_ratio) { start_deadman(vertex_time_limit); for (size_t i=0; i<max_vertices && !had_alarm; ++i) g.add_vertex(); for (size_t i=g.num_vertices()*edge_to_vertex_ratio; i>0; --i) g.add_edge(yagi_random_vertex(g), yagi_random_vertex(g)); }
Totals yagi_time_add_vertex() { GraphType g; start_deadman(2); Sawyer::Stopwatch t; while (!had_alarm && g.num_vertices()<MAX_VERTICES) g.add_vertex(); t.stop(); return report("add vertex", yagi_size(g), g.num_vertices(), t, "verts/s"); }
Totals yagi_time_remove_vertex() { GraphType g; start_deadman(2); while (!had_alarm && g.num_vertices()<MAX_VERTICES) g.add_vertex(); GraphSize gsize = yagi_size(g); size_t nv_orig = gsize.first; start_deadman(2); Sawyer::Stopwatch t; for (size_t i=0; i<nv_orig && !had_alarm; ++i) g.remove_vertex(yagi_random_vertex(g)); t.stop(); size_t nremoved = nv_orig - g.num_vertices(); return report("vert erase", gsize, nremoved, t, "verts/s"); }
Totals yagi_time_add_edge() { GraphType g; start_deadman(2); while (!had_alarm && g.num_vertices()<MAX_VERTICES) g.add_vertex(); start_deadman(2); Sawyer::Stopwatch t; while (!had_alarm && g.num_edges()<MAX_EDGES) { typename GraphType::VertexDescriptor v1 = yagi_random_vertex(g); typename GraphType::VertexDescriptor v2 = yagi_random_vertex(g); g.add_edge(v1, v2); } t.stop(); return report("add edge", yagi_size(g), g.num_edges(), t, "edges/s"); }