graph function added