adapted to use maps for edges and naming