Sort paths in descending order of term frequency