ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 04 Jan 2023 19:32:45 +0100Finding subset of lists with common entrieshttps://ask.sagemath.org/question/65732/finding-subset-of-lists-with-common-entries/ Suppose I have a list of lists. For example,
[ [1, 2, 3, 4], [1, 3, 1, 3], [4, 1, 4, 1], [1, 3, 2, 1], [4, 1, 2, 4] ]
I want SageMath to give me a sub-list of this list that consist of lists where any two have at least one common entry. For example,
[ [1, 2, 3, 4], [1, 3, 1, 3], [1, 3, 2, 1] ]
or
[ [4, 1, 4, 1], [1, 3, 2, 1], [4, 1, 2, 4] ] .
What would be even more amazing is if SageMath could find the largest possible such sub-list. How could I get SageMath to do this? Thank you in advance!merluzaWed, 04 Jan 2023 19:32:45 +0100https://ask.sagemath.org/question/65732/