builds adjacency maps!