perlquestion
baxy77bax
Dear all <p>
I am trying to compute the number of intersecting array elements for multiple arrays (essentially elements belonging to separate parts of venn diagrams).
Initially and naively I thought this should be an easy thing to do and for 2 arrays it is:<p>
1. Make a hash table for one array with keys being its elements <br>
2. Loop through another array and count if an element exists in the previously created hash table <br>
3. Subtract the number of shared elements from the total number of elements of each array. <br> <p>
But when the number of arrays increases the number of possible intersections between respective arrays increases (for A,B,C arrays we have A/B, A/C, B/C, A/B/C). So the problem I am having is how to scale the above algorithm. <p>
Does anyone know a solution to this problem even if a limited number of sets can only be included (I think this is an NP problem thus any algorithm that can produce a solution for more than 7 arrays would be acceptable) <p>
Thank you