Correct the error calculating average path length.
Change sum(lengthList)/len(lengthList)-1
to     sum(lengthList)/(len(lengthList)-1)