improved edge type transformation