title: Is there any algorithm to form groups based on ranking?
body: <p>I'm looking for an algorithm to form groups based on ranking choices. For example, I have a class of 20 and I would want groups of 3 and the rest to be in group of 2, and the students will rank perhaps top 6 people they would like to group with.</p>
  <p>I've looked into the stable marriage algorithm but I feel it's not very suitable as it's better for pairs.</p>