Graph avg

I added comments to each function.