Filtering a list of list for certain elements that are neighbours

*To*: mathgroup at smc.vnet.net*Subject*: [mg88834] Filtering a list of list for certain elements that are neighbours*From*: Steven Siew <stevensiew2 at gmail.com>*Date*: Sun, 18 May 2008 07:34:18 -0400 (EDT)

I have a list of lists mylist={{a,b,c},{a,c,b},{b,a,c},{b,c,a},{c,a,b},{c,b,a}} I want to filter out all lists that have "a being a neighbor to b". I am looking for the following result. {{a,c,b},{b,c,a}} For this toy example, I can probably do it by hand but my real problem has 120 lists in a list. And I need to filter out various combination of letters like "s cannot be next to d" , "s cannot be next to j" , "c cannot be next to j" , "h cannot be next to d" and "h cannot be next to s".

**Follow-Ups**:**Re: Filtering a list of list for certain elements that***From:*Carl Woll <carlw@wolfram.com>

**Re: Filtering a list of list for certain elements that are neighbours***From:*Curtis Osterhoudt <cfo@lanl.gov>

**Re: Filtering a list of list for certain elements that are neighbours***From:*"W_Craig Carter" <ccarter@mit.edu>

**Re: Filtering a list of list for certain elements that are neighbours***From:*Curtis Osterhoudt <cfo@lanl.gov>