get_path function

Computing the path according to the provided method