Array representation and adjacency list representation and application