title: How to find the least amount of common sets
body: <p>Given the sets </p>
  
  <p>{1,2,3,4}
  {2,3,4}
  {1,4}
  {1}</p>
  
  <p>What is an easy (and preferably performant) algorithm to find the groups:
  {1}
  {2,3}
  {4}</p>
  
  <p>Since this is the shortest list of sets where:</p>
  
  <ul>
  <li>all members (1-4) are represented.</li>
  <li>2 and 3 are grouped together because they always appear together in the original sets.</li>
  </ul>
  
  <p>The real data is a bunch of references, not value types.</p>
  
  <p>EDIT: I don't think summarizing what I've tried does anything to help the question, and only serve as a distraction as there probably is an algorithm in category theory for this, but (for entertainment reasons) here goes:</p>
  
  <ul>
  <li>I've aggregated on hash sets trying to use union operator.</li>
  <li>I've performed groupedby on aggregate on gethashcode.</li>
  <li>I've iterated over the list using the first entry as a candidate set, seeking to gradually reduce it when comparing against other members. This did not perform well and I'm not sure it ended up with the fewest amount of sets possible.</li>
  </ul>