Add graph function