Home > Software engineering >  Order set according to other sets
Order set according to other sets

Time:02-10

Since its hard for me to describe what I want in general, I try it with an example:

Given a set {x,y,z,d} and subsets {x,z}, {d,y} and {x,y}, I would like to order the first set {x,y,z,d} so that the small sets dont get torn apart (the permutation in each set is not important, so {x,y} or {y,x} is the same}.

The length of the example sets can be larger than what is given here. The small sets are always real subsets of the largest set.

I think it would be nice to have a way to say ok this part of the set has to stay in this configuration (x has to be next to y), but this part is arbitrary. Any recommendation how to do it? I tried to do it with a tree, but I am completely failing with this problem:(

CodePudding user response:

  •  Tags:  
  • Related