title: Given a set of points in 3d space, find all sets of points within a distance of eachother
body: <p>I have a set of 3d points <strong>S</strong>.
  I need to find the set <strong>X</strong> of all sets of points in <strong>S</strong> which are within manhattan distance <strong>d</strong> of each other.</p>
  
  <p>i.e. for each set <strong>Y</strong> in <strong>X</strong> there exists atleast one point in 3d space that is within distance <strong>d</strong> of all points in <strong>Y</strong></p>
  
  <p>The length of set <strong>S</strong> will never be >20 but I will have to run this analysis on a stream of sets which are being produced at ~10 new sets per second, so whatever solution I use will have to be fairly efficient.</p>
  
  <p>an example to help visualize the problem, given the following:</p>
  
  <p><a href="https://i.stack.imgur.com/B3L7t.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B3L7t.png" alt="points"></a></p>
  
  <p>the output would be ((A,B), (B,C,E), (B,D,E))</p>
  
  <p>we only care about the largest possible sets so the sets (B,C), (B,D), (B,E), (C,E) and (D,E), while within the given parameters, are not in the output given they are subsets of other sets in <strong>X</strong></p>
  
  <p>also this I'm doing this in java but any pointers in terms of algorithms or pseudo code would be greatly appreciated, thanks in advance.</p>