self-loops are empty lists in short path
Calculate lengths of paths