73.148 CommonRepresentatives

CommonRepresentatives( J, K )

When J and K are both lists of n sets, the list L is formed where L[i] := { j ;:; J[i] cap K[j] ne emptyset }. A system of distinct represetatives reps for L provides a permutation of the elements of K such that J[i] and K[i] have non-empty intersection. Taking the first element in each of these intersections determines a system of common representatives com. The function returns the pair [ com, reps ]. Note that there is no requirement for the representatives to be distinct. See also the next section.

   gap> K := [ [3,4], [1,2], [2,3], [2,3,4] ];;
    gap> CommonRepresentatives( J, K );
    [ [ 3, 3, 3, 1 ], [ 1, 3, 4, 2 ] ]  

This has produced 3 in J[1] cap K[1], 3 in J[2] cap K[3], 3 in J[3] cap K[4] and 1 in J[4] cap K[2].

Previous Up Top Next
Index

GAP 3.4.4
April 1997