# Generate Graphs

Learn how to create a graph generator for testing purposes.

## We'll cover the following

## Test examples

One of the challenges with testing data structures is to have a suitable number of test examples. We have two approaches to dealing with this:

Include a library with a large number of instances.

Provide a set of generator functions.

Ideally, we would have both a full atlas of standard and example small graphs and a library of graph generators available to us for testing.

We already have a few examples of graphs in our `NativeGraph.Examples`

module. This library could be expanded.

As for graph generators, let’s create a simple graph generator to get a taste of what can be done.

## Graph generator

We create a new module called `NativeGraph.Builder`

and add this `random_graph/1`

function:

Get hands-on with 1200+ tech skills courses.