Hi,
I have two arrays of elements say, A = {1, 2} and B = {3, 4} for a working example. The way they are generated in a multi-step process, there is no control over the order of elements. So A may also be {2, 1} and so is true for B.
Now I want to create one-to-one thread from A -> B, which would give o/p either {1-> 3, 2-> 4} or {1-> 4, 2-> 3}. By using Permutations[B] in stead of B, one can generate all possible threads.
Now I want to pick one of those, which is more likely. For above example, I know that 1-> 4 is more likely than 1-> 3 so the correct thread would be the one with it so {1-> 4, 2-> 3} should be preferred over {1-> 3, 2-> 4} as o/p. Now my question is how to do this mathematically. How to tell mathematical that out of n possible elements in an table, pick one over all others (n-1) depending upon the preference of i->j present in the elements. Following is the code for working example. SelectFirst seems to be a good choice for doing it, but I could not code the condition part properly.
Will appreciate any help on this, or any other alternative function to get this done. Thanks
A = {1, 2};
B = {3, 4};
BB = Permutations[B];
CC = Table[Thread[A -> BB[[i]]], {i, 1, Length[B]}]