Add graph generation function