Ported in makeedges() routine, although it is still untested and has not been incorperated yet