Add graph generation code