composition of functions from graph