# Permutation of a list toward a symbol

Here is a question difficult to explain (it's the reason of the weird title).

Say I have a set of elements

s = {a, b, c}


for wich I want to construct the set of all possible permutations of the form

s = {a ** b, a ** c, b ** c}


where ** stands for either >, or <. The desired output in this case is

{{a < b, a < c, b < c},{a < b, a > c, b < c},{a < b, a < c, b > c},{a < b, a > c, b > c}, {a > b, a < c, b < c},{a > b, a > c, b < c},{a > b, a < c, b > c},{a < b, a > c, b > c}}

• Thanks corey979 but it is not exactly what I expect. I want b ** a transformed eventually in a ** b and ** should be Greater ... or -> – cyrille.piatecki Nov 10 '16 at 11:07
• corey979 I dont understand what is unclear here is on a simpler set what I expect {a, b, c} Gives {{a < b, a < c, b < c}, {a < b, c < a, b < c},{a < b, a < c, c < b}, {a < b, c < a, b < c}, {b < a, a < c, b < c}, {b < a, c < a, b < c},{b < a, a < c, c < b}, {b < a, c < a, b < c}} or {{a -> b, a -> c, b -> c}, {a -> b, c -> a, b -> c},{a -> b, a -> c, c -> b}, {a -> b, c -> a, b -> c}, {b -> a, a -> c, b -> c}, {b -> a, c -> a, b -> c},{b -> a, a -> c, c -> b}, {b -> a, c -> a, b -> c}} – cyrille.piatecki Nov 10 '16 at 11:33
• Dear Cyrille, I took the liberty to rephrase your question. See if it's really what you are after. – corey979 Nov 10 '16 at 11:39

With

s = {a, b, c}


make

sub = Subsets[s, {2}]


{{a, b}, {a, c}, {b, c}}

and

tup = Tuples[{Greater, Less}, {Length@sub}]


{{Greater, Greater, Greater}, {Greater, Greater, Less}, {Greater, Less, Greater}, {Greater, Less, Less}, {Less, Greater, Greater}, {Less, Greater, Less}, {Less, Less, Greater}, {Less, Less, Less}}

Then

Table[MapThread[Apply, {tup[[i]], sub}], {i, 1, Length@tup}]


{{a > b, a > c, b > c}, {a > b, a > c, b < c}, {a > b, a < c, b > c}, {a > b, a < c, b < c}, {a < b, a > c, b > c}, {a < b, a > c, b < c}, {a < b, a < c, b > c}, {a < b, a < c, b < c}}

• Ok I was wrong but I want all the possible permutations. Not only {a > b, a > c, a > d, b > c, b > d, c > d} but also {b > a, a > c, a > d, b > c, b > d, c > d} , {b > a, c > a, a > d, b > c, b > d, c > d}... And how to replace > by -> ? – cyrille.piatecki Nov 10 '16 at 11:15
• I have edited the question but I was precise I have writen a symbol like (<) or an arrow of substitution (->) – cyrille.piatecki Nov 10 '16 at 11:23