Find the list that best matches reference list
MaximalBy[Length[a⋂#]&]@{b,c}
{{"S280", "G281", "I282", "I284"}}
MinimalBy[Length@Complement[a,#]&]@{b,c}
{{"S280", "G281", "I282", "I284"}}
Maybe:
LongestCommonSequence[a, b]
{"S280", "G281", "I282", "I284"}
LongestCommonSequence[a, c]
{"A278", "G279"}
Length@LongestCommonSequence[a, #] & /@ {b, c}
{4, 2}
Suppose I have the reference list a
and a matrix otherLists
of all other lists I want to compare against a
:
otherLists[[Ordering[Length[#] & /@ (Complement[a, #] & /@ otherLists), 1]]]
This will return the list that best matches a
.