sort outbound/inbound links
(cherry picked from commit d5a2b38)