Random Matroids - Donald e Knuth (1974) 82696137
Random Matroids - Donald e Knuth (1974) 82696137
Random Matroids - Donald e Knuth (1974) 82696137
RANDOM MATROIDS*
Donald E. KNUTH
Stanford University, Stanford, Coli/. 94305, USA
O. Introduction
* This research was supported in part by National Science Foundation Grant GJ-36473X and
by the Office of Naval Research Contract NR-044-402.
342 D.E. Knuth / Random matroids
2. A general construction
Step 2. [Generate covers.] Let 9'r+l be the set of all "covers" of the
sets in 9'" i.e.,
9'r+l={AUa:AE9'r and aEE\A}.
Step 3. [Enlarge.] Add additional sets to :;"+1' if desired, where each
new set properly contains some element of 9'r. (This step is indetermin-
ate. By making different choices we will in general produce different
matroids.)
Step 4. [Superpose.] If :tr+l contains any two sets A, B whose inter-
section A n B is not contained in C for any C E :tr , replace A and B in
9'r+ 1 by the single set A U B. Repeat this operation until A n B ~ C for
some C E :tr whenever A and B are distinct members of :tr +1 . (We shall
prove later that the replacements can be made in any order without af-
fecting the final result of this step.)
Step 5. [Test for completion.] If E E :tr+l' terminate the construc-
tion. Otherwise increase r by 1 and return to Step 2.
This construction terminates because every member A of :tr+l proper-
ly contains some member of :tr , hence A contains at least r+ I elements.
We shall prove that the family .
:t= :to U :tl U ... U :tr u :tr+l
obtained at the conclusion of the construction defines the closed sets of
a matroid, no matter what choices are made in Step 3.
3. A "random" example
Before going into any details of the proof, let us look at a concrete
example in order to fix the ideas. For convenience in notation we shall
use the decimal digits {O, I, ... , 9} as elements of the set E. Subsets of E
will be written without braces or commas, so that" 156" stands for the
3-element subset consisting of I, 5 and 6; and "{ 156,23}" stands for a
family of two subsets of E.
The construction of Section 2 begins with :to = { }, then Step 2
tells us that :tl is the family {O, 1,2,3,4,5,6, 7,8,9} of all singleton sub-
sets. Let us assume that the first execution of Step 3 leaves :tl un-
changed; consequently Step 4 will also leave :tl unchanged. (It turns out
that any changes made to :tl at this point are equivalent to "shrinking"
E into a smaller set. By leaving :11 unchanged we will be constructing a
D.E. Knuth / Random matroids 345
568,1237,1239,1245,1246,1247,1248,1249,1257,
1267,1269,1278,1279, J289, 1357, 1367, 1369, 1378,
1389,1456,1457,1458,1467,1468,1469,1478,1479,
1489,1567,1578,1678,1679,1689,1789,2347,2349,
2457.2459,2467,2469,2478,2479,2489,2579,2679,
2789,3457,3459,3467,3469,3478,3489,4567,4569,
4578,4579,4589,4678,4679,4689,4789,5679,5789,
6789} .
Note that our construction needed only six 3-element sets to specify the
entire matroid, so this approach leads to economy in specification.)
4. Proof of correctness
Let us now prove that the family 9' = ':10 U ':II U ... U ':I r U ':I r+ 1 de-
fined by our construction yields a matroid. We shall prove that (E, ':I) is
D.E. Knuth / Random matroid, 347
Clearly A'" ~ A, since A is such a closed set, and we have proved that A'"
is closed, hence A'" = A: our definition of A in this section agrees with
the definition in Section I. Now Axiom (iii) follows immediately.
S. Proof of completeness
6. Commutativity
7. Free completion
8. Some experiments
Table 1
21 15 48 51
32 24 76 89
23 IS 48 51
32 24 76 89
23 15 48 51
31 23 74 82
27 19 62 61
23 10 63 36
23 15 48 51
30 22 71 76
Table 2
Observed mean values.
n (p Jo P2, ... ) Trials Bases Circuits II '1 2 11 II '1311 II '141'1 II 01 511 II '1611 11'1,11
9. Open problems
A few research problems have been stated above, and they will be
repeated here for emphasis.
(I) If an order ideal in the lattice of subsets of E does not correspond
to the sets of rank s;;;., of any matroid, is its free completion always trivial,
or do we obtain a generalization of matroid behavior?
(2) What can be said about the fewest number of enlargements needed
352 D.E. Knuth / Random matroids
,
The computer programs used in this study are presented here for the
possible benefit of others who wish to experiment with matroids, and
also for the possible interest of language designers, because there is still
a relative scarcity of published algorithms dealing with manipu'lation of
sets. The programming is in ALGOL W [9], a language chosen by the
author primarily because of the excellent debugging facilities available
[5] ; it will not be difficult to transliterate the programs below into
other languages.
The running time of the construction in the text is governed largely
by the speed of Step 4, which would be extremely inefficient if pro-
grammed in a brute force manner based on the definitions. The imple-
mentation below reduces this cost substantially by combining Steps 2, 3
and 4, using a routine that maintains a list of subsets satisfying the con-
dition at the end of Step 4 at all times, so that the basic operation is one
of inserting into such a list. The inner loop of this insertion process is
kept short by using a table that tells whether or not any given subset has
rank ~r.
The time and space requirements of these algorithms for manipulating
random matroids grow exponentially with n = II Ell, as one might expect.
The program below assumes that n ~ 13, but with suitable modifications
it would be possible to adapt the program so that cases as large as n = 20
become feasible on contemporary medium-to-Iarge scale computers.
Sets are represented in the program by the so-called bits variables of
ALGOL W, since these variables are subject to Boolean operations. It is
also convenient at times to consider bits variables as binary numbers, so
that they can be used as subscripts or in arithmetic operations. If v is of
type bits, ALGOL W uses the notation nu.mber(v) for the corresponding
integer; if u is of type integer, the notation bitstring(u) stands for the
D.E. Knuth / Random mJltroidr 3S3
procedure insert;
begin comment insert set x into list nh, but augmenting x if necessary
(and deleting existing entries of the list) so that no two
entries have an intersection of rank> r;
integer j, k;
; :=nh;
store: S[nh) :=x;
loop: k :=;;
continue: j:= L [k);
if rank [number(S[j) 1\ x») ~ r then go to loop;
if j"* nh then
begin if x = (x v S[j)) then
begin remove from list and continue:
L[k] :=L[j);L[il :=avail;avail:=j;
go to continue;
end else
begin augment x and go around again:
x :=x v S(j); nh := j; go to store;
356 D.E. Knuth / Random matroids
end;
end;
insert new item:
j :=avail; avail:= L [j]:
L[j] :=L[nh];L[nh] :=j;S[j] :=x;
end;
procedure enlarge;
begin comment insert sets read from data cards until encountering an
empty set;
readon(x):
while x *- #0 do
begin insert; readon(x) end;
end;
procedure printstatistics;
begin integer j:
write ("Closed sets for rank", r, ":");
j:=L[h];
whilej *- h do
begin writeon(S[j]),; j := L [j] end;
end;
procedure sort;
begin integer array hd[ 100: : 113);
for i := 100 until 100+n do hd[i] := -1;
j:=L[h];L[h):=h;
*"
while i h do
begin i :=rank[number(S[j)));
k := L [j); L [j] := hd[i]; hd[i] := j; j := k;
end;
358 D.E. Knuth / Random matroids
Acknowledgments
I wish to thank Stein Krogdahl and Daniel Kleitman for their helpful
comments on the first draft of this paper.
References
[1) H.H. Crapo and G.-C. Rota, On the Foundations of Combinatorial Theory: Combinatorial
Geometries (preliminary edition) (MIT Press, Cambridge, Mass., 1970).
[2J 1. Edmonds, Submodular functions, matroids, and certain polyhedra, Combinatorial Struc-
tures and their Applications, Proc. Calgary International Conference 1969 (Gordon and
Breach, New York, 1970) 69-87.
(3) D.E. Knuth, The asymptotic number of geometries, J. Combln. Theory 16(B) (1974) 398-400.
(4) E.L. Lawler, Combinatorial Optimization: Networks and Matroids (Holt, Rinehart and
Winston, New York, in preparation).
(5) E. Satterthwaite, Debugging tools for high level languages, Software-Practice and Ex-
perience 2 (1972) 197 -217.
(6) W.T. Tutte, A homotopy theorem for matroids, I and II, Trans. Am. Math. Soc. 88 (1958)
144-174.
(7) W.T. Tutte, Matroids and graphs, Trans. Am. Math. Soc. 90 (1959) 527-552.
(8) H. Whitney, On the abstract properties of linear dependence, Am. J. Math. 57 (1935) 509-
533.
(9) N. Wirth and C.A.R. Hoare, A contribution to the development of ALGOL, Comm. ACM 9
(June 1966) 413-434.