add lexicographical sorting for path depth