BugFix: sort affinity edges by its weight