Given a list of parameters and associated values, how can I generate a list of all common associations? For instance, given
list = {{AA, 3}, {AB, 2}, {AB, 4}, {BA, 2}, {BA, 5}, {BB, 6}};
I want to obtain
{{AA, 3}, {AB, {2, 4}}, {BA, {2, 5}}, {{AB, BA}, 2}, {BB, 6}}
(Edit) Both answers from both kglr and mef will break down under certain circumstances, eg., When
list = {{{15, "->", 15}, 3}, {{15, "->", 15}, 8}, {{16, "->", 16}, 2}, {{16,"->", 16}, 3}, {{16, "->", 16}, 4}, {{16, "->", 16}, 5}, {{16, "->", 16}, 6}, {{16, "->", 16}, 7}, {{16, "->", 16}, 8}}
the solution from kglr gives
{{{15, "->", 15}, {3, 8}}, {{16, "->", 16}, {2, 3, 4, 5, 6, 7, 8}}, {{{15, "->", 15}, {16, "->", 16}}, 3}}
and the solution from mef gives
{{{15, "->", 15}, {3, 8}}, {{16, "->", 16}, {2, 3, 4, 5, 6, 7, 8}}, {{{15, "->", 15}, {16, "->", 16}}, 8}}
where the desired result is
{{{15, "->", 15}, {3, 8}}, {{16, "->", 16}, {2, 3, 4, 5, 6, 7, 8}}, {{{15, "->", 15}, {16, "->", 16}}, {3, 8}}}
(Edit #2) It may be helpful if I describe what I’m actually looking at. Given a list labeled graphs of order n which includes a mix of graphs which are pairwise either isomorphic or non-isomorphic, and each graph is uniquely identified by a number
listGi ={1,2,3,…};
Each labeled graph Gi has a Kirchhoff matrix which is invariant to some transformation from the permutation group.
KirchhoffMatrix[Gi] == Pj.KirchhoffMatrix[Gi].Transpose[Pj];
Each element of the permutation group is also uniquely identified by a number,
Pj = {1,2,3,…};
I then have a list of each Gi “associated” with an element of the permutation group which leaves its Kirchhoff matrix invariant (I ignore the identity element of the permutation group). For example, in a particular mix of graphs which are pairwise either isomorphic or non-isomorphic I have
listA = {{{1 -> 1}, 17}, {{2->2}, 17}, {{3->3}, 24}, {{4->4}, 24}, {{5->5}, 8}, {{6->6}, 17}, {{7->7}, 8}, {{8->8}, 2}, {{8->8}, 7}, {{8->8}, 8}, {{8->8}, 17}, {{8->8}, 18}, {{8->8}, 23}, {{8->8, 24}, {{9-9}, 6}, {{9-9}, 8}, {{9-9}, 10}, {{9-9}, 15}, {{9-9}, 17}, {{9-9}, 19}, {{9-9}, 24}};
What I want is a list of the Gi’s which are invariant to common Pj’s. And the list of all the P’j that leave KirchhoffMatrix[Gi] invariant which are not specified in the first instance. (LLIAMnYP describes this more rigorously with his analogy of sub-matrices.) For input listA above my desired output is:
{{{8->8}, {9->9}, {8, 17, 24}}, {{8->8}, {2,7,8,17,18,23,24}}, {{9->9},{6,8,10,15,17,19,24}}, {{{3->3},{4->4},{8,8},{9,9}}, 24}, {{{5->5},{7->7},{8->8},{9->9}}, {8}}, {{{1->1},{2->2},{6->6},{8->8},{9->9}}, 17}}
This solution is correctly obtained by LLIAMnYP in his answer. I thought I could get my point across with a single example, but I was wrong! When I repeatedly pointed out where proposed answers did not do what I wanted, I was accused of continuously changing the problem. Not true, I had to change the specific example of listA to show that the proposed answers were not solving the problem. My many thanks to LLIAMnYP for his insight and diligence to finally understand and solve my question. I am surprised that the solution proved to be as difficult as it was. And, again, I thought I could communicate the problem with a single simple example. Mr.Wizard proposed a solution which did not give the correct result. However his proposed solution did give results which were not part of my original quest, which, however, I found interesting in retrospect. His solution included those Pj which were unique to a Gi and were not otherwise included in the output list. For instance, an example from listA above, {Pj} = {2,7,18,23} are unique to {8->8}. If anyone could pose a solution which does the same thing as LLIAMnYP’s answer and included these unique “associations”, I would be grateful. I can visually compare an example input listA (one that is not too long, anyway) with the output list and see if it produces my desired output. My desired result is not ambiguous, apparently it is just tricky to describe.

{AB, {2, 4}}and{BA, {2, 5}}and{{AB, BA}, 2}are present. Would just{AB, 4}, {BA, 5}, {{AB, BA}, 2}not work? – LLlAMnYP Mar 02 '18 at 09:29