Convert a list of dependencies into groups