Generate Maximal subsets based on mutual/subset property
Sorry for the imprecise language - I'm not a mathematician.
Given a list/set/dict/etc., is there a function/method available that will generate subsets, with the possibility of non-null intersections, based on some user defined mutual/subset property?
E.g., given a list [0,1,2,3,4,5], generate the maximal lists such that the maximum difference within each list is 3. For the given list, the function would produce [[0,1,2,3],[1,2,3,4],[2,3,4,5]]. For the list [0,3,9,10,17,30,33], this function would produce [[0,3],[9,10],,[30,33]].
This is different than the usual filtering operation in that the defining property is about the returned lists/sets/etc., not just about the individual elements.
Function should work with members of ZZ, QQ, RR, RDF, CC, CDF, and others if possible.