Graph Test Case Generator


How it works

Draw case:

  1. Enter the number of nodes and click on Generate Graph button
  2. Choose whether it is a directed grpah or undirected
  3. Drag and drop nodes to adjust their position
  4. To add an edge, click on the first node then click on the second node
  5. To delete an edge, follow the same above step
    Note: in Case of directed grpahs you have to click on the source node then on the destination node (in order)

  6. The test case follows the typical format in all graph problems:
    The first line consists on two integers, (n) & (m), where (n) is the number of nodes and (m) is the number of edges
    (m) lines follow, each containing two integers (i) & (j), meaning that there is an edge between node (i) and node (j)
  7. The app currently supports unweighted graphs only.

Random case:

  1. Enter the number of nodes and the number of edges.
  2. Select the properties of the graph (Edges bi-directionality and weight).
  3. Click on Generate Case button
  4. The test case follows the typical format in all graph problems:
    The first line consists on two integers, (n) & (m), where (n) is the number of nodes and (m) is the number of edges
    (m) lines follow, each containing two integers (i) & (j), meaning that there is an edge between node (i) and node (j)
    If the graph is weighted, the edges line will contain the weight of the edge as a third integer.
  5. You can copy the test case directly from the panel on the right.
WARNING: graphs with more than 1000 nodes may freeze your browser.