Generate graph on the fly