Remove '- 1' in source_to_target_distances() to properly index targetIDs