title: Removing (grouping by) arrays which are subsets of the biggest array
body: <p>I have a dataset which looks like this:</p>
  
  <pre><code>| path              |
  |-----------------  |
  | {16,13}           |
  | {16,85}           |
  | {16,85,1}         |
  | {16,85,2}         |
  | {16,85,15}        |
  | {16,85,80}        |
  | {16,85,80,1}      |
  | {16,85,80,63}     |
  | {16,85,80,63,1}   |
  </code></pre>
  
  <p>The path column represents a kind of hierarchical path through a graph, from some node to a another node. I'm trying to collapse each path down into the longest paths from root to leaf nodes - it should be noted that the order of the elements is important (<code>{1, 2, 3}</code> != <code>{3, 2, 1}</code>). </p>
  
  <p>As an example:</p>
  
  <ul>
  <li>The path <code>{16, 13}</code> is the longest path containing both 16 and 13 <em>in that order</em>, so it stays.</li>
  <li>The path <code>{16, 85}</code> is not the longest, as there is a longer path containing those elements <em>in that order</em>, namely <code>{16, 85, 2}</code>. Therefore the row with <code>{16, 85}</code> should be discarded from the result set, and <code>{16, 85, 2}</code> should be kept as it happens to be the longest.</li>
  <li>Etc. with every other row</li>
  </ul>
  
  <p>So the resulting set looks like:</p>
  
  <pre><code>| path              |
  |-----------------  |
  | {16,13}           |
  | {16,85,1}         |
  | {16,85,2}         |
  | {16,85,15}        |
  | {16,85,80,1}      |
  | {16,85,80,63,1}   |
  </code></pre>
  
  <p>I'm not sure even where to start with this, everything I've tried has failed. </p>
  
  <p>I've found that there is something called the array contains operator <code>@&gt;</code>, but don't really know how the apply it.</p>
  
  <p>Is there a reasonable query for doing this? Any help would be great. Thanks!</p>