Add graph printing function