built Adjacency List and stored all edge weights into an array