The issue is generated by the fact that paths 'shrink' when encoded through higher-order nodes, and this is not tackled correctly by (IndexError occurs if a path shorter than the tested order is added last. A problem in the computation of the optimal order could also emerges if the shortest paths in dataset is shorter than the tested order) has to account for it correctly.
The following code raises and IndexError.
The issue is generated by the fact that paths 'shrink' when encoded through higher-order nodes, and this is not tackled correctly by (IndexError occurs if a path shorter than the tested order is added last. A problem in the computation of the optimal order could also emerges if the shortest paths in dataset is shorter than the tested order) has to account for it correctly.