average shortest path implemented