Finished avg path length implementation