Here we give some background for the mathematician with no knowledge of the theory of algorithms. Typically there are many different possible algorithms for a particular problem; the theory of algorithms seeks “optimal” algorithms according to some notion of “cost”. Cost is usually “time”, i.e. number of computational steps, but sometimes involves criteria such as (storage) space or simplicity of coding. The phrase randomized algorithm refers to settings where the problem itself does not involve randomness but where randomness is introduced into the running of the algorithm. Why this is useful is best seen by example; the textbook of Motwani and Raghavan [265] provides a comprehensive range of examples and classifications of types of problems where randomized algorithms have proved useful. We give three standard examples below (not using Markov chains) and then proceed to talk about algorithms using random walks on graphs.
Statistical sampling.
Consider a population of individuals. Suppose we wish to know the proportion of the population with some attribute, i.e. who answer “Yes” to some Yes/No question. To calculate exactly we need to question all individuals. But if we can sample uniformly at random from the population, then we can estimate approximately and can bound the size of error in probability. To do this, we sample independently random individuals, question them, and calculate the empirical proportion of Yes answers. Use as our estimate of , and theory gives error probabilities
Such confidence intervals are discussed in every freshman statistics course. Classical statististical sampling is conceptually a bit different from algorithms, in that the “cost” here refers to real-world costs of interviewing human individuals (or experimenting on individual rats or whatever) rather than to computational cost. However, the key insight in the formula above is that, for prescribed allowable error , the cost of this simple random sampling is and this cost does not depend on the “problem size” (i.e. population size) . The next example is a slightly more subtle use of sampling in a slightly more algorithmic context.
Size of a union of sets.
It’s fun to say this as a word problem in the spirit of Chapter 1. Suppose your new cyberpunk novel has been rejected by all publishers, so you have published it privately, and seek to sell copies by mailing advertizements to individuals. So you need to buy mailing lists (from e.g. magazines and specialist bookshops catering to science fiction). Your problem is that such mailing lists might have much overlap. So before buying lists (where is a set of names and addresses) you would like to know roughly the size of their union. How can you do this without knowing what the sets are (the vendors won’t give them to you for free)? Statistical sampling can be used here. Suppose the vendors will allow you to randomly sample a few names (so you can check accuracy) and will allow you to “probe” whether a few specified names are on their list. Then you can sample times from each list, and for each sampled name probe the other lists to count the number of lists containing that name. Consider the identity
where is the number of lists containing a uniform random name from . You can estimate by , and the error has standard deviation , and the resulting estimate of has error
As in the previous example, the key point is that the cost of “approximately counting” to within a small relative error does not depend on the size of the sets.
Solovay-Strassen test of primality [312].
We can’t improve on the concise description given by Babai [37].
Let be an odd integer. Call an integer a Solovay-Strassen witness (of compositeness of ) if and either g.c.d. or , where is the Jacobi symbol (computed via quadratic reciprocity as easily as g.c.d.’s are computed via Euclid’s algorithm). Note that no S-S witness exists if is prime. On the other hand (this is the theorem) if is composite, then at least half of the integers are S-S witnesses.
Suppose now that we want to decide whether or not a given odd 200-digit integer is prime. Pick integers independently at random from . If any one of the turns out to be a witness, we know that is composite. If none of them are, let us conclude that is prime. Here we may err, but for any , the probability that we draw the wrong conclusion is at most . Setting is perfectly realistic, so we shall have proven the mathematical statement “ is prime” beyond the shade of doubt.
Our focus is of course on randomized algorithms using random walks or Markov chains. We will loosely divide these into three categories. Markov chain Monte Carlo seeks to simulate a random sample from a (usually non-uniform) given probability distribution on a given set. This is the central topic of Chapter 11. In section 10.4 below we give a selection of miscellaneous graph algorithms. Into this category also falls the idea (Chapter 6 section 8.2) (yyy 10/31/94 version; details to be written) of using random walk as a “undirected graph connectivity” algorithm, and the idea (end of section 10.2.2) of using random walk paths as an ingredient in constructing edge-disjoint paths in an expander graph. A third, intermediate category is the specific topic of approximate counting via Markov chains, to be discussed in section 10.5.