Hey,

What is the concept behind graph problems test case generation.

How can I write a random test case generator ?

# | User | Rating |
---|---|---|

1 | Um_nik | 3459 |

2 | tourist | 3438 |

3 | maroonrk | 3359 |

4 | ecnerwala | 3347 |

5 | Benq | 3317 |

6 | ksun48 | 3309 |

7 | boboniu | 3300 |

8 | Petr | 3293 |

9 | Radewoosh | 3289 |

10 | TLE | 3223 |

# | User | Contrib. |
---|---|---|

1 | Errichto | 206 |

2 | Monogon | 193 |

3 | SecondThread | 191 |

4 | pikmike | 188 |

5 | antontrygubO_o | 187 |

6 | vovuh | 185 |

7 | Ashishgup | 182 |

8 | Um_nik | 180 |

9 | Radewoosh | 169 |

10 | pashka | 166 |

Hey,

What is the concept behind graph problems test case generation.

How can I write a random test case generator ?

↑

↓

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Sep/18/2020 19:31:29 (i1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

You can use Spoj-Toolkit

Do you need connected graph?

yes

Well, what is a graph? It's a set vertices with a set of pairs of these vertices.

Once the number of vertices and the number of edges are fixed you need just to generate several random pairs. That's it.

However, the resulting graph might be not so good for a specific problem so you may need to specialize this generation algorithm. For instance, if you need a connected graph one possible way is to generate a tree first and then add some more edges (you can see how tree can be generated in testlib examples).

Thank you all.

Im not looking for specific type of graphs, I want to learn a concept so I become able to generate any type of graphs any time needed.

Why spoj-toolkit is taking too much time to generate string/tree of size 100000,and still not generating. At bottom , it's showing "connecting to server".

Well, I first build a random tree using Prufer Code and then simply add random edges to that tree to convert it into Graph. Since I first built the tree using Prufer Code, the graph finally built is connected.

I don't know if this is the proper method of building graph, but for generating random trees, Prufer Code is the proper method.

More on Prufer Code.

This is fast and efficient https://test-case-generator.herokuapp.com/