delete edges before deleting nodes