changed implementation of hasEdge from map based to ufd based (on the way to remove any map)