update grpah function