connect edges(need a bidirectional map)