add code to generate adjecent list