group and order dependencies by type