I have a list like:
list1={{1, 16}, {1, 14}, {1, 3}, {1, 18}, {1, 2}, {1, 17}, {2, 17}, {2, 18}, {3, 14},{4,10}}
I would like to see if the first element of one nested list is an element of the first nested list and if so, append the second element of this list to the first list. Such that:
list2={{1, 16, 14, 3, 18, 2, 17}, {2, 17,...}, {3, 14,...},...}
My aim is to form a nested list of the chains of connected data. Any help at all would me much appreciated.
list2={{1, 16, 14, 3, 18, 2, 17, 2, 17,...}, {3, 14,...},...}
because2
was already part of the first list at that point? ` $\endgroup$GroupBy[list1, First -> Last]
work for you? $\endgroup$