implementation of random graph with adjancy list