Added compressPath function to Util

Allows paths to be reduced to a minimum number of nodes without altering the shape of the path.