generate a graph