gradient for paths