clustering working with straight and curved edges