better handling of graph generation