DECIDING ST-CONNECTIVITY IN UNDIRECTED GRAPHS USING LOGARITHMIC SPACE

MASTERS THESIS

Presented in Partial Fulfillment of the Requirements for

the Degree Master of Science in the Graduate

School of the Ohio State University

By

Peter Lawson Maceli, B.A.

*****

The Ohio State University 2008

Approved by Thesis Committee:

Professor Neil Robertson, Advisor Advisor Professor Timothy Carlson Graduate Program in Mathematics

ABSTRACT

In 2004 Omer Reingold gave a deterministic log-space algorithm which solves the problem of st-connectivity in undirected graphs. The motivating idea behind Rein- gold’s algorithm was the observation that this problem is essentially trivial for con- stant degree graphs with logarithmic diameter. The crux of Reingold’s algorithm is that an arbitrary undirected graph can be transformed in log-space into such a graph.

Though this transformation results in a much more complicated graph it allows us to solve this fundamental algorithmic question in log-space.

Additionally, the problem of undirected st-connectivity is complete for the space complexity class SL, the class of problems solvable by symmetric, non-deterministic, log-space computations. And so as a corollary to Reingold’s log-space algorithm we have that SL=L, where L is the class of problems solvable by deterministic log-space computations.

In this thesis, we examine this algorithm in depth and discuss a number of its consequences.

ii Dedicated to my father

iii ACKNOWLEDGMENTS

Mathematically, I would like to thank my advisor Professor Neil Robertson and Pro- fessor Tim Carlson for all their help and support in preparing this thesis.

Additionally, I would also like to thank the following teachers who have had a great impact on me: Professor Yuiji Ilyashenko at Cornell University, Professor David

Brown at Ithaca College, Professor Heather Johnston at Vassar College, Professor

Alan Greenleaf at the University of Rochester, as well as Dave Bock, Marytherese

Pasquale-Bowen, Roselyn Teukolsky and Steve Weissburg at Ithaca High School.

Personally, I would like to thank the following people for all their years of friend- ship: Emile and the entire Bokaer family, Andrew Douglas, Mike Erb, Anthony

Fischetti, Jake Hascup, George and Sarah Herman, Daniel Hochman, Jesse Pompilio,

John George Regula, Damon Vorce and Alexis Zaharris.

Finally, I would like to thank my family: My sister Monica, my mother Alison and my father John.

iv VITA

2006-Present ...... Graduate Teaching Associate, The Ohio State University

2006 ...... B.A. in Mathematics, cum laude, Cornell University

PUBLICATIONS

Research Papers

• D. Brown, Symmetric Fractal Trees in Three Dimensions, Chaos, Solitons & Fractals, 32(2): 284-295, 2007.

• T. Brendle and B. Farb, The Birman-Craggs-Johnson Homomorphism and Abelian Cycles in the Torelli Group, Mathematische Annalen, 338(1): 33-53, 2007.

FIELDS OF STUDY

Major Field: Mathematics

Specialization: Combinatorics

v TABLE OF CONTENTS

Abstract ...... ii

Dedication ...... iii

Acknowledgments ...... iv

Vita...... v

CHAPTER PAGE

1 Introduction ...... 1

2 Preliminaries ...... 3

2.1 Computational complexity basics ...... 3 2.2 Expander graphs ...... 9 2.3 The problem of undirected st-connectivity ...... 18

3 Undirected st-connectivity in log-space ...... 24

3.1 ST-Connectivity in constant degree expander graphs . . . 24 3.2 The zig-zag product ...... 26 3.3 Transforming graphs into expanders ...... 30 3.4 Reingold’s log-space algorithm for USTCON ...... 35

4 Consequences of Reingold’s algorithm ...... 39

4.1 SL=L ...... 39 4.2 Additional problems solvable in log-space ...... 40

Bibliography ...... 41

vi CHAPTER 1

INTRODUCTION

Imagine you find yourself in a new city with no map and only the address of the house where you’re staying. Assuming that you’re too stubborn to stop and ask for directions, you instead opt to set off on foot in hopes of finding the house. In doing so you are effectively creating your own map of the city. And so if you’re careful you can be sure to not to go around in circles, visiting the same streets and places again and again. This approach will eventually get you to your destination but it requires a tremendous amount of time and memory, linear in the size of the city. However, suppose you don’t have anything to write with and thus you can only remember the address of the house you’re trying to find, where you currently are and perhaps a few more items of that magnitude, logarithmic in the size of the city. That is, suppose you could only remember an effectively finite number of streets, landmarks and locales.

Could you ever hope to arrive at your destination?

Mathematically, this situation can be viewed as a problem exploring a given undirected graph. Specifically, the problem of determining whether we can find a path between two particular vertices. In this thesis we present a (surprising) algorithm, due to Reingold, which allows us to answer this fundamental question when we only allow ourselves an extremely limited amount of memory.

1 In Chapter 2, we present the necessary background material and work needed to define and analyze this problem. In particular, we present some computational complexity basics which allow us to rigorously define the amount of space required by a computation. We then give a short introduction to expander graphs, which are the central underlying mathematical object of this thesis. Finally, we give a brief summary of the previous work done on this problem.

In Chapter 3, we present in full Reingold’s log-space undirected st-connectivity algorithm. We begin with the motivating result that the problem is essentially trivial for constant-degree expander graphs. We then define the zig-zag graph product which is of great use as it allows us to increase the expansion of a given graph via powering while maintaining a graph of constant degree. This graph product in then used to define a log-space transformation capable of converting a general inputed undirected graph into an expander graph of constant-degree. Finally, we show how Reingold used this transformation to give an algorithm capable of solving undirected st-connectivity in logarithmic space.

In Chapter 4, we examine the consequences of Reingold’s algorithm in the context of the space complexity hierarchy surrounding logarithmic space. In doing so we obtain his celebrated result that SL = L. We also present a number of other graph theoretic problems which as a result of this reduction can now also be solved in logarithmic space.

2 CHAPTER 2

PRELIMINARIES

2.1 Computational complexity basics

Definition 2.1.1. A k-string Turing machine, where k ≥ 1 is an integer, is a quadru- ple M = (K, Σ, δ, s). Where K is a finite set of states that the machine may assume and s ∈ K is the initial state. Σ is a finite set of symbols, referred to as the alpha- bet of M, which we assume is disjoint from K. Additionally, Σ always contains the special symbols t and . : The blank and the first symbol. Finally, δ is a transition function which maps K × Σk to (K ∪ {h, “yes”, “no”}) × (Σ × {←, →, −})k. Where the halting state h, the accepting state “yes”, the rejecting state “no” and the cursor directions ← for “left,” → for “right” and − for “stay” are not in K ∪ Σ.

We think of δ as the “program” of our machine. For given a state and read symbols δ dictates the next step our machine takes. That is, δ(q, σ1, . . . , σk) =

(p, ρ1,D1, . . . , ρk,Dk) means that if M is in state q and the cursor on the ith string reads in a σi then the next state of M will be p and cursor on the ith string will write

ρi and then move in the direction indicated by Di. A configuration of a k-string Turing machine is a (2k + 1)-tuple

(q, w1, u1, . . . , wk, uk), where q is the current state, the ith string reads wiui and

3 the cursor on the ith string is reading in the last symbol of wi.A k-string Turing machine M starts its computation on an input string x ∈ (Σ − {t})∗ with the configuration (s, ., x, ., , . . . , ., ). If M halts at a “yes” configuration after some

M ∗ number of steps, which we denote (s, ., x, ., , . . . , ., ) −−→ (“yes”, w1, u1, . . . , wk, uk) for some strings w1, u1, . . . , wk, uk, then we say that M(x) = “yes”. Likewise, if M

∗ halts at a “no” configuration after some number of steps, say (s, ., x, ., , . . . , ., ) −−→M

(“no”, w1, u1, . . . , wk, uk), then we say that M(x) = “no”.

Definition 2.1.2. A language L is a subset L ⊂ (Σ − {t})∗, that is, a set of strings of symbols. Let M be a Turing machine such that, for any string x ∈ (Σ − {t})∗, if x ∈ L then M(x) = “yes” and if x∈ / L then M(x) = “no”. Then we say M decides

L.

This set up may seem too simplistic to tackle very complex programming problems but in fact this is all we need. It is also enough to define the intuitive notion of run- time.

Definition 2.1.3. Suppose that for a k-string Turing machine M and input x

M t (s, ., x, ., , . . . , ., ) −−→ (H, w1, u1, . . . , wk, uk) for some H ∈ {h, “yes”, “no”}. Then the time required by M on input x is t. Furthermore, suppose that f is a function from N to N. We say that the Turing machine M operates within the time bound f(n) if for any input string x the time required by M on x is at most f(|x|), where

|x| denotes the length of the string x.

That is, the time required for a “program” to run is simply the number of steps required for the corresponding Turing machine to halt. It should be noted that it is

4 possible given an input x for a machine M to never reach a halting state but we are not concerned with this situation here.

Definition 2.1.4. Let L be a language. We say that L is in the complexity class

TIME(f (n)) if there is a Turing machine which decides L and operates within time bound f(n).

We now define an alternative notion of complexity in which we concern ourselves not with the amount of time it takes for a “program” to run but, rather with the amount of space required. In order to do so it seems reasonable that we should ignore the sizes of the input and output, if any. Hence, we define a slightly modified version of our k-string Turing machine.

Definition 2.1.5. For k > 2 we define a k-string Turing machine with input and output as in Definition 2.1.1 with the additional restriction on δ:

Whenever δ(q, σ1, . . . , σk) = (p, ρ1,D1, . . . , ρk,Dk) then we require that ρ1 = σ1 and

Dk 6=←. That is, we require that the first string of M is effectively a read-only input string and the last string of M is effectively a write-only output string.

Definition 2.1.6. Suppose that for a k-string Turing machine M and input x

M ∗ (s, ., x, . . . , ., ) −−→ (H, w1, u1, . . . , wk, uk) where H ∈ {h, “yes”, “no”} is a halt- Pk ing state. Then the space required by M on input x is i=1 |wiui|. If M is a machine Pk−1 with both input and output then the space required by M on input x is i=2 |wiui|, as the first string stores the input and the kth string simply gives the output and so they can be disregarded. Furthermore, suppose that f is a function from N to N. We say

5 that the Turing machine M operates within space bound f(n) if, for any input x, M requires space at most f(|x|).

Definition 2.1.7. Let L be a language. We say that L is in the complexity class

SPACE(f (n)) if there is a Turing machine with input and output which decides L and operates within space bound f(n).

We are now in a position to define the central object of study in this paper.

Definition 2.1.8. Logarithmic space L := SPACE(log (n)).

We also define the slight generalization.

Definition 2.1.9. For α fixed Lα := SPACE(logα (n)).

We also briefly define nondeterministic machines for completeness.

Definition 2.1.10. A k-string nondeterministic Turing machine with input and out- put is a quadruple N = (K, Σ, ∆, s) as before in Definition 2.1.5. However, ∆ is no longer a function but rather a

∆ ⊂ (K × Σk) × (K ∪ {h, “yes”, “no”}) × (Σ × {←, →, −})k.

Thus we see that for each configuration of our nondeterministic machine there can be more than one valid next configuration or even none at all. And so in the course of a computation we are free to make any choice of the several valid next steps as given by ∆. This branching freedom is the central notion and power of nondeterministic computation.

6 Definition 2.1.11. Let N be a nondeterministic Turing machine and let L be a language. Since nondeterministic machines do not have a single, uniquely defined next action we say N decides L if for any x ∈ Σ∗ the following holds: x ∈ L

∗ if and only for some sequence of steps in ∆ we have that (s, ., x, ., , . . . , ., ) −→N

(“yes”, w1, u1, . . . , wk, uk).

Definition 2.1.12. Suppose that for a k-string nondeterministic Turing machine N

N t and input x we have that (s, ., x, ., , . . . , ., ) −→ (H, w1, u1, . . . , wk, uk) for some H ∈ {h, “yes”, “no”}. Then the time required by N on input x is t. Furthermore, suppose that f is a function from N to N. We say that the nondeterministic Turing machine N operates within the time bound f(n) if, for any input string x and no matter what computational path we choose, the time required by N on x is at most f(|x|).

Definition 2.1.13. Let L be a language. We say that L is in the complexity class

NTIME(f (n)) if there is a nondeterministic Turing machine which decides L and operates within time bound f(n).

Definition 2.1.14. Suppose that for a k-string nondeterministic Turing machine

N ∗ N and input x we have that (s, ., x, . . . , ., ) −→ (H, w1, u1, . . . , wk, uk) where H ∈ {h, “yes”, “no”} is a halting state. Then the space required by N on input x is Pk i=1 |wiui|. If N is a machine with both input and output then the space required Pk−1 by N on input x is i=2 |wiui|, as the first string stores the input and the kth string simply gives the output and so they can be disregarded. Furthermore, suppose that f is a function from N to N. We say that the nondeterministic Turing machine N operates

7 within space bound f(n) if, for any input x and no matter what computational path we choose, N requires space at most f(|x|).

Definition 2.1.15. Let L be a language. We say that L is in the complexity class

NSPACE(f (n)) if there is a nondeterministic Turing machine with input and output which decides L and operates within space bound f(n).

Definition 2.1.16. Nondeterministic logarithmic space NL := NSPACE(log (n)).

Additionally, for a more complete view of the complexity classes surrounding L and NL we briefly define the following classes and refer to [Pap94] and [LP82] for the details.

Definition 2.1.17. The complement of any nondeterministic complexity class C, which we denote coC := {L¯ : L ∈ C}, where L¯ = Σ∗ − L. Specifically, we are interested in coNL := {L¯ : L ∈ NL}.

Definition 2.1.18. Randomized logarithmic space, RL, is the class of problems solv- able by randomized, logarithmic space bounded Turing machines.

Definition 2.1.19. Symmetric logarithmic space, SL, is the class of problems solvable by symmetric, logarithmic space bounded Turing machines.

8 2.2 Expander graphs

On a basic intuitive level we may think of expander graphs as sparse graphs which are nevertheless highly connected. In what follows we present two alternative yet equivalent approaches to making this notion of expansion rigorous, one combinatorial and the other algebraic.

Combinatorially, we would like to somehow quantitate the expansiveness of a given graph G. We do this by proportionally looking at the number of edges which link disjoint subsets of vertices.

Definition 2.2.1. The (edge) expansion ratio of a graph G on N vertices, denoted h(G), is defined as:

|E(S, S¯)| h(G) = min , N |S| {S⊂V : S6=∅ and |S|≤ 2 } where E(S, S¯) is the set of all edges between S and S¯ = V − S.

For example, consider the complete graph on N vertices KN . Then by definition any vertex in S is connected to all the vertices in S¯ and so |E(S, S¯)| = |S × S¯| =

|S|(N − |S|). Hence, the expansion ratio of the complete graph on N vertices is

lN m h(KN ) = min N − |S| = . N 2 {S⊂V :|S|≤ 2 }

N We further observe that h(G) > 0 if and only if G is connected. Also, if |S| ≤ 2 then h(G) · |S| ≤ |E(S, S¯)| and so we see that if h(G) is not small then every small subset of vertices has many outgoing edges, giving us an idea of the expansion of G.

In light of this observation we make the following definition.

9 Definition 2.2.2. An undirected graph G is called an -expander graph if

h(G) ≥  > 0.

We now present an alternative algebraic notion of expansion which, while less natural than our combinatorial definition, is more suited to the types of problems we aim to solve.

Definition 2.2.3. The adjacency matrix M of an undirected graph G on N vertices, is the N ×N matrix whose (u, v) entry equals the number of edges that go from vertex u to vertex v. Being real and symmetric, the matrix M has N real eigenvalues which we denote by λ1 ≥ λ2 ≥ · · · ≥ λN . We refer to the eigenvalues of M as the spectrum of the graph G.

For example, the adjacency matrix of complete graph on N vertices KN is J − I, where I is the identity matrix and J denotes the matrix whose entries are all 1. It’s corresponding spectrum is thus (N − 1), −1,..., −1, where the eigenvalue N − 1 has multiplicity one and the eigenvalue −1 has multiplicity N − 1. It turns out that complete graphs are uniquely determined by their spectrum though this is rarely the case in general. However, it is easily shown that if two graphs are isomorphic then they have the same spectrum. A useful tool in proving that two graphs are not isomorphic, since eigenvalues can be compute rather efficiently.

For reasons that will later become clear we concern ourselves with the case when

G is a D-regular undirected graph on N vertices. Now, by the D-regularity of G it is clear that D is an eigenvalue of M with corresponding eigenvector 1 = (1,..., 1) ∈

RN , since D-regularity means exactly D edges are incident to every vertex and so

10 each row and column sum is equal to D. Next, suppose µ is another eigenvalue of M with corresponding eigenvector u. Settingu ˆ = (|u1|,..., |uN |) then since M ≥ 0 we have that MuˆT ≥ |µ|uˆT . And so as M is symmetric we have that

D(1 · uˆT ) = (1D)ˆuT = (1 · M)ˆuT = 1 · (MuˆT ) ≥ 1 · (|µ|uˆT ) = |µ|(1 · uˆT ).

And so we see that D ≥ |µ|, that is, that every eigenvalue of M lies in the interval

[D, −D].

So far there has been nothing to suggest how this algebraic structure we have asso- ciated to a given graph relates to our previous combinatorial definition of expansion.

However, the following theorem gives the connection.

Theorem 2.2.4. Let G be a finite, connected, D-regular graph on N vertices with spectrum λ1 = D ≥ λ2 ≥ · · · ≥ λN . Then

D − λ 2 ≤ h(G) ≤ p2D(D − λ ). 2 2

This theorem was proved by Dodziuk [Dod84] and independently by Alon-Milman

[AM85] and Alon [Alo86].

From this we see how a D-regular graph’s spectral gap, which we define to be

D − λ2, is closely related to it’s expansion ratio. In particular, from the lower bound we see that a large spectral gap implies high expansion and from the upper bound we see that high expansion implies a large spectral gap. We are interested in, and so only prove, the lower bound and refer the reader to [HLW06] for a proof of the upper bound, which is the discrete analogue of a theorem of Cheeger on Riemannian manifolds.

11 First we observe that for a real symmetric matrix one can obtain the correspond- ing eigenvalues using a special quotient know as the Rayleigh quotient.

Lemma 2.2.5. Let A be a real symmetric matrix with eigenvalues λ1 ≥ λ2 ≥ · · · ≥

λN and let v1, . . . , vN be the corresponding orthonormal system of eigenvectors. Then for every k = 1,...,N

xAxT λk = max 2 . x6=0, x⊥v1, x⊥v2,..., x⊥vk−1 kxk

Proof. We are concerned with and so only present a proof in the case when k = 2.

However, extending to the general case is only a matter of notation. Let x =

N (x1, . . . , xN ) be a nonzero vector in R with respect to the orthonormal basis v1, . . . , vN

T perpendicular to v1. Since x⊥v1 we know that x1 = 0. And so we have that xAx =

T T T T T T xA(x1v1 + ··· + xN vN ) = x(x1Av1 + ··· + xN AvN ) = x(x1λ1v1 + ··· + xN λN vN ) =

2 2 2 2 2 x1λ1 +···+xN λN , which as x1 = 0 and λ2 ≥ · · · ≥ λN , ≤ λ2(x2 +···+xN ) = λ2kxk .

xAxT Thus, we see that λ2 ≥ kxk2 . The result follows as the value λ2 is obtained for the basis vector v2.

Proof. (of Theorem 2.2.4)

We know that the adjacency matrix M of the graph G is real symmetric and by the

D-regularity of G we have that D is the largest eigenvalue of M with corresponding √ √ N normalized eigenvector v1 = (1/ N,..., 1/ N) ∈ R . In light of the above lemma

D−λ2 in order to show that 2 ≤ h(G) it suffices to find a vector x⊥v1 with a large xMxT Rayleigh quotient kxk2 ≥ D − 2h(G). Let S be a nonempty subset of V with

12 N |E(S,S¯)| ¯ |S| ≤ 2 such that h(G) = |S| and take x = |S|1S − |S|1S¯, where 1X denotes the characteristic vector of the set X. First we note that x⊥v , since v = √1 1 and 1 1 N

T ¯ T ¯ T T ¯ ¯ x · 1 = (|S|1S − |S|1S¯) · 1 = |S|(1S · 1 ) − |S|(1S¯ · 1 ) = |S||S| − |S||S| = 0.

Next, we evaluate the Rayleigh quotient:

xMxT = 2|E(S,S)||S¯|2 + |E(S,¯ S¯)||S|2 − |S||S¯||E(S, S¯)|,

kxk2 = |S¯|2|S| + |S|2|S¯| = |S||S¯|(|S¯| + |S|) = N|S||S¯|.

Since G is D-regular we have that:

D|S| = 2|E(S,S)| + |E(S, S¯)| and D|S¯| = 2|E(S,¯ S¯)| + |E(S, S¯)|.

Thus it follows that

xMxT ND|S||S¯| − N 2|E(S, S¯)|  N |E(S, S¯)| λ ≥ = = D − ≥ D − 2h(G), 2 kxk2 N|S||S¯| |S¯| |S|

¯ N D−λ2 since |S| = N − |S| ≥ 2 . Therefore, we have that h(G) ≥ 2 .

Since we understand the largest eigenvalue λ1 = D of D-regular graphs due to the above result it is useful to consider the second largest eigenvalue (in absolute value).

Definition 2.2.6. Given a D-regular graph G on N vertices with spectrum λ1 = D ≥

λ2 ≥ · · · ≥ λN we define λ(G) = max(|λ2|, |λN |).

13 Definition 2.2.7. Let 0 < α ≤ 1 be some positive constant. A D-regular undirected graph G on N vertices with spectrum λ1 ≥ λ2 ≥ · · · ≥ λN is called an (N, D, α)-graph if λ(G) ≤ αD.

From the spectral gap theorem above we see that an (N, D, α)-graph G is such

D(1−α) that 2 ≤ h(G) and so we see that G is a better expander the closer α is to zero, that is, when the spectral gap is bounded away from zero.

Examples : Recalling that the complete graph on N vertices KN has spectrum

1 (N −1), −1,..., −1 we see that KN has a spectral gap of N and is an (N,N −1, N−1 )- graph. However, we are concerned with finding explicit families of expander graphs of some small constant degree. These are much more difficult to construct and usual depend on results from number theory and representation theory.

We define a family of 4-regular graphs which lie on the grid Zm × Zm, such that the vertex (x, y) has edges to the four vertices (x + y, y), (x − y, y), (x, x + y) and

(x, x − y) where all operations are done mod m. Margulis [Mar73] showed that this is an expander family and his proof of expansion was based on representation theory.

In fact, this family of graphs was the first explicitly constructed family of constant degree expander graphs.

Next, we define a family of 3-regular graphs on (p + 1)-vertices for every prime p. Here, we take Vp = Zp ∪ {∞} and a vertex x is connected to the three vertices x + 1, x − 1 and its inverse x−1 where all operations are done mod p and we define the inverse of 0 to be ∞. Lubotzky, Philips and Sarnak [LPS88] showed that this is an expander family and their proof of expansion depends on the Selberg 3/16 theorem, a deep result in number theory.

14 The following result attempts to quantify how large the spectral gap can be in the case we are interested in, namely when D is fixed and N is large.

Theorem 2.2.8. If G is a D-regular graph on N vertices then √ λ(G) ≥ D(1 − oN (1)),

where oN (1) is a quantity that tends to zero for every fixed D as N −→ ∞.

Proof. Let M be the the adjacency matrix of G. We know that the (u,v) entry of the matrix M k gives the number of different walks from vertex u to vertex v in G of length k. And so we see that trace(M k) gives the number of walks of length k in G which start and end at the same vertex. Hence as G is D-regular we know that all the diagonal entries of M 2 are at least D, as we can simply just move back and forth along any of the D edges incident to the given vertex. Thus, we see that trace(M 2) ≥ ND. However, from linear algebra we know that

N 2 X 2 2 2 trace(M ) = λi ≤ D + (N − 1)λ(G) . i=1 Hence, we see that ND ≤ trace(M 2) ≤ D2 +(N −1)λ(G)2, which gives that λ(G)2 ≥ √ √ N−D N−D 2 N−D N−D D−1 D· N−1 ≥ D·( N−1 ) , since N−1 < 1. Therefore, λ(G) ≥ D· N−1 = D(1− N−1 ) = √ D−1 D(1−oN (1)), since for every fixed D we see that N−1 goes to zero as N −→ ∞.

We also have the following upper bound which will be of use later.

Theorem 2.2.9 ([AS00]). If G is D-regular, connected, non-bipartite graph on N vertices then 1 λ(G) ≤ D − . N 2

15 This result is important as it gives that every connected, regular, non-bipartite graph is an expander. Specifically, we see that any D-regular, connected, non-

1 bipartite graph on N vertices is infact an (N,D, 1 − DN 2 )-graph. The spectrum of a graph also reveals many fundamental graph theoretic proper- ties. In the following we see what the spectrum tells us about the diameter of a given graph.

In a graph G, the distance between two vertices u and v, denoted d(u,v), is defined to be the length of a shortest path joining u and v in G. The diameter of G, denoted by Diam(G), is the maximum distance over all pairs of vertices in G.

Theorem 2.2.10. For a D-regular undirected graph G on N vertices with second largest eigenvalue (in absolute value) λ(G) we have that

llog (N − 1)m Diam(G) ≤ D . log λ(G) Proof. Let M be the adjacency matrix of the D-regular graph G on N vertices. It is a well know fact that the (u,v) entry of the matrix M k gives the number of different walks from vertex u to vertex v in G of length k. And so we see that determining the Diam(G) is the same as finding the minimal value k such that M k > 0. Now, let λ1 ≥ λ2 ≥ · · · ≥ λN be the eigenvalues of M with the corresponding orthonormal system of eigenvectors v1, . . . , vN . Since G is D-regular we know that λ1 = D and √ √ may assume v1 = (1/ N,..., 1/ N). Also as λ(G) was taken to be the second largest eigenvalue in absolute value we also have that |λi| ≤ λ(G) for all i = 2,...,N.

Since v1, . . . , vN is an orthonormal system of eigenvectors corresponding to λ1, . . . , λN

P T we have that M = i λivi vi. Now, we want for each u and v that

16 k X k T (M )u,v = λi (vi vi)u,v i Dk X ≥ − λk(v ) (v ) N i i u i v i>1 Dk X ≥ − λ(G)k |(v ) ||(v ) | N i u i v i>1 Dk  X 1/2 X 1/2 ≥ − λ(G)k |(v ) |2 |(v ) |2 N i u i v i>1 i>1 Dk  1/2 1/2 = − λ(G)k 1 − (v )2 1 − (v )2 N 1 u 1 v Dk 1 = − λ(G)k(1 − ) N N > 0.

Dk D k 1 This will happen if λ(G)k = ( λ(G) ) > N(1 − N ) = N − 1, that is, when k > log (N−1) log (N−1) D . Therefore, we have that Diam(G) ≤ d D e. log λ(G) log λ(G)

We should note that this upperbound for the diameter is tight for some graphs, such as the complete graphs. Additionally, this proof can be easily extended to obtain the more general result for arbitrary graphs:

Theorem 2.2.11 ([Chu89]). Let G be an undirected graph on N vertices with spec- trum λ1, λ2, . . . , λN with corresponding orthonormal eigenvectors v1, v2, . . . , vn where

|λ1| ≥ |λ2| ≥ · · · ≥ |λN |. If we take w = mini |(v1)i| then we have that

2 llog (1−w ) m Diam(G) ≤ w2 . log |λ1| |λ2|

17 2.3 The problem of undirected st-connectivity

Given an undirected graph G and two vertices s and t, the undirected st-connectivity problem, denoted USTCON, is to decide whether or not the two vertices are connected by a path in G. This basic problem is of interest as it is a common subroutine encountered in more complicated graph algorithms. Thus, we would like to know just how efficiently we can solve it with regard to both time and space. In terms of time complexity USTCON is well understood. The elementary breadth-first search and depth-first search methods both solve USTCON in linear time. However, the space required by these methods is also linear, since the breadth-first search method must store all of the nodes at a given depth in order to generate the nodes at the next depth while the depth-first search method requires space on the order of the length of the longest simple path in the graph.

These breadth-first search and depth-first search methods also solve the more difficult problem of st-connectivity in directed graphs in linear time. We formally state this problem as follows: Given a G and two vertices s and t the

REACHABILITY problem is to decide whether or not there is a directed path from s to t in G. The first real progress with respect to the space complexity of USTCON was made by Savitch [Sav70] who showed that the harder problem of REACHABILITY could be solve in SPACE(log2 (n)).

Theorem 2.3.1 ([Sav70]). REACHABILITY ∈ L2.

Proof. Let G be a graph with N vertices and let s and t be two vertices in G.

We define a recursive function PATH(x, y, k) which accepts and halts if and only

18 if there is a path from x to y in G of length at most k. In the base case k = 1

PATH(x, y, 1) accepts if and only if there is an edge between x and y or if x = y.

For k ≥ 2 we compute PATH(x, z, bk/2c) and PATH(z, y, dk/2e) for every vertex z 6= x, y, where the space required to compute PATH(x, z, bk/2c) is reused to compute

PATH(z, y, dk/2e). If both calls accept for some vertex z then PATH(x, y, k) halts and returns true. Otherwise, PATH(x, y, k) rejects and returns false. This recursion is founded on the very basic observation that any path of length k from x to y has a midpoint z which is of length at most dk/2e from both x and y. And so we see that computing PATH(s, t, N) for our given graph G solves REACHABILITY.

Now we consider the space required in computing PATH. Let S(k) be the worst case space use of PATH(·, ·, k). In the base case the space required is simply a counter needed to search the input tape for the correct entry of the adjacency matrix and so

S(1) = O(log N). In general, for k ≤ N we see that S(k) = O(log N)+S(dk/2e), since we need to keep track of the current midpoint vertex z and the required recursive calls.

Thus, we have that S(k) = O(log k ∗ log N). Hence, we see that the space required to compute PATH(s, t, N) is O(log2 N) and so we have that REACHABILITY ∈ L2.

It is conjectured that Savitch’s above result is optimal with respect to space.

Also, REACHABILITY is easily seen to be complete for NL and so the above result gives that NL ⊆ L2. This result suggests that nondeterminism is considerably less powerful with respect to space than it is with respect to time.

19 Theorem 2.3.2 ([Imm88]). Given a graph G on N vertices and a vertex s, the number of vertices reachable from s in G can be computed in nondeterministic logarithmic space.

Proof. Let R(k) be the number of vertices in the graph G reachable from s by paths of length k or less. Since any vertex reachable from s is reachable using a path of length at most N − 1 we are interested in computing R(N − 1). We now describe an algorithm made up of three nested for loops which allows us to nondeterministically compute R(N − 1) in log-space.

Set R(0) = 1. for k = 1, 2,...,N − 1 we compute R(k) from R(k − 1).

Set ` = 0 and initialize R(k) = 0.

for every vertex v in G we check to see if v is reachable in one step or less

from some vertex u reachable from s by paths of length k − 1 or less.

for every vertex u in G we make a nondeterministic guess whether u is

reachable from s in k − 1 steps or less.

if guess is “yes” then we nondeterministically try to guess a path from

s to u of length k − 1 or less.

if the guessed path does not lead to u then we break and move on

to the next u.

Otherwise, u is reachable from s and we increment ` := ` + 1.

Additionally, if u = v or (u, v) is an edge in G then we see that v is

reachable from s by a path of length k or less and so we increment

20 R(k) := R(k) + 1 then break and move on to the next v.

if after running through all vertices u in G we have that ` < R(k − 1) then

we have failed to verify R(k − 1) by our nondeterministic guesses and

so we break and move on to the next v.

Finally, after we have finished the above three loops we return the desired value

R(N − 1).

Now, at any point in the course of computation the above algorithm needs the space to store `, R(k − 1) and R(k). Additionally, we need a variable of constant size to store our nondeterministic guess whether u is reachable from s in k − 1 steps or less and in following some nondeterministically guessed path from s to u we need only remember the current vertex and the guessed possible next vertex. Since all of these are all at most N reusing space we see immediately that the above algorithm runs in nondeterministic log-space. Next, we argue by induction on k that the above algorithm correctly computes R(k).

In the base case k = 0, we set R(0) = 1, since s is trivially reachable from s in zero steps. Next, we assume that R(k) is equal to the number of vertices in the graph

G reachable from s by paths of length k or less. Now, the above algorithm fails to increment R(k + 1) for a specific vertex v only if v is not reachable in one step or less from all vertices u of distance k or less from s. Hence, we see that R(k + 1) is incremented for a specific vertex v if and only if v is reachable from s by a path of length k + 1 or less. Thus, by induction we are done.

21 The above result due to Immerman and Szelepsc´enyi shows that NL = coNL, since it nondeterministically answers the complement of the NL complete problem

REACHABILITY using logarithmic space. This result can also be extended to show that nondeterministic space classes are closed under complement which is most likely not the case when dealing with time classes.

Another important step was made by Aleliunas, Karp, Lipton, Lov´asz and Rack- off [AKL79]. They showed that a random walk starting from an arbitrary vertex of any connected undirected graph will visit all the vertices of the graph in a polynomial number of steps. This gives rise to a very practical probabilistic log-space algorithm for USTCON. To determine if s and t are connected in G simply perform a poly- nomial length random walk starting at s and check if the walk ever reaches t. This can clearly be done in log-space as essentially all we need to remember is the current vertex and the number of steps we have taken. And so we see that USTCON ∈ RL.

Also, essentially SL was defined by Lewis and Papadimitriou [LP82] to be the complexity class for which USTCON would be complete. In fact, SL is commonly defined to be the complexity class of problems log-space reducible to USTCON.

In light of these results related to st-connectivity, we have the following view of the space complexity classes which surround logarithmic space:

L ⊆ SL ⊆ RL ⊆ NL = coNL ⊆ L2.

Since then all progress went via probabilistic algorithms and their derandomiza- tion. Proceeding along these lines Nisan, Szemeredi and Wigderson [NSW89] showed that USTCON ∈ L3/2. Obtaining the first improvement of Savitch’s algorithm in

22 the undirected case. Improving on these methods Armoni, Ta-Shma, Wigderson and

Zhou [ATS00] showed that USTCON ∈ L4/3. This was the most space efficient

USTCON algorithm until that of Reingold [Rei05] which we explore in detail in the following chapter.

23 CHAPTER 3

UNDIRECTED ST-CONNECTIVITY IN LOG-SPACE

3.1 ST-Connectivity in constant degree expander graphs

The reason why we are so interested in expander graphs in the context of USTCON is because st-connectivity in constant degree graphs with logarithmic diameter can be trivially solved in log-space. Expander graphs are a family of such graphs well suited to our needs.

Theorem 3.1.1. Given a D-regular undirected graph G on N vertices whose connected components each have logarithmic diameter there exists a space O(log D · log N) al- gorithm A which determines st-connectivity for any vertices s and t in G.

Proof. Suppose the connected compound of G which contains s has diameter ` =

O(log N). The algorithm A simply enumerates the D` paths of length ` emanating from s. A outputs ‘connected’ if and only if at least one of these paths encounters t.

Since G is D-regular a specific path from s of length ` is uniquely determined by a sequence of ` edge labels in {1,...,D}. And so we see that enumerating all D` paths requires space O(log D · log N). Also, following any particular path given by a sequence of edge labels requires space O(log N), as we need only remember the current vertex and how many steps we have taken. And so A uses space O(log D · log N).

24 In the case that s and t are in the same connected we know the distance between s and t is at most ` and the algorithm A will indeed find a path and output ‘connected’. However, A never outputs ‘connected’ unless it finds a path from s to t, implying that A outputs ‘connected’ if and only if s and t are in the same connected component of G. Thus, resolving the question of st-connectivity.

Now, via Theorem 2.2.10 we observe that expander graphs have logarithmic di- ameter and so we can restate the above theorem as follows:

Theorem 3.1.2. Let 0 < α < 1 be some constant. Then there exists a space O(log D· log N) algorithm A such that when a D-regular undirected graph G on N vertices is inputed the following hold:

(i) If s and t are in the same connected component and this component is an

(N 0, D, α)-graph then A outputs ‘connected’.

(ii) If A outputs ‘connected’ then s and t are in the same connected component.

Proof. Let CG(s) be the connected component of G containing the vertex s. By

0 Theorem 2.2.10 if CG(s) is an (N , D, α)-graph we know that

llog (N 0 − 1)m llog (N 0 − 1)m Diam(C (s)) ≤ ≤ := ` = O(log N). G log D log 1 λ(CG(s)) α Taking A to be the algorithm described above in Theorem 3.1.1 we are done.

25 3.2 The zig-zag product

In [RVW02] it is shown how one may use their zig-zag graph product to give new explicit constructions of expander graphs. Since we know from Section 3.1 that

USTCON is solvable in log-space on constant degree expander graphs we will use this method to transform in log-space an arbitrary undirected graph into a constant degree expander thus solving USTCON in its general setting.

First, we define the following representation of a graph, which is very useful as when moving from vertex u to vertex v in a regular graph it allows us to keep track of the edge we traversed to get to v.

Definition 3.2.1. For a D-regular undirected graph G on N vertices we define the rotation map RotG :[N] × [D] −→ [N] × [D] such that RotG(v, i) = (w, j) if the i’th edge incident to v leads to w and this edge is the j’th edge incident to w.

In terms of the rotation map, we can realize the (u, v) entry of the adjacency matrix M of the D-regular graph G as follows:

Mu,v = |{(i, j) ∈ [D] × [D]: RotG(u, i) = (v, j)}|.

In our setting this definition is also a fundamental tool in saving space. This is because in following a path given by edge labels we need only remember where we currently are and how many steps we have taken.

Now, from the spectral gap theorem we know that an (N, D, α)-graph G is such

D(1−α) that 2 ≤ h(G) and so we see that G is a better expander the closer α is to zero. We are thus interested in an operation which increases expansion, that is, which

26 decreases α. Now, if we don’t require that our graphs remain of bounded degree then one basic transformation capable of improving a graphs expansion is powering.

Definition 3.2.2. Let G be a D-regular multigraph on N vertices given by rotation

k k map RotG. The k’th power of G is the D -regular graph G whose rotation map is given by RotGk (v0, (a1, a2, . . . , ak)) = (vk, (bk, bk−1, . . . , b1)), where these values are computed via the rule (vi, bi) = RotG(vi−1, ai).

Traditionally the k’th power of a graph is defined to be the graph on the same vertex set such that there is an edge between two vertices if and only if there is a path of length at most k joining them. And so as each sequence (a1, a2, . . . , ak) of k edge labels in G corresponds directly to a walk in G of length k we see how our above definition of powering in terms of the rotation map agrees with the standard notion of powering.

Theorem 3.2.3. If G is an (N, D, α)-graph then Gk is an (N,Dk, αk)-graph.

Proof. The result follows directly from the fact that the adjacency matrix of Gk is the k’th power of the adjacency matrix of G. And so, if G has spectrum λ1, λ2, . . . , λN

k k k k then the graph G has spectrum λ1, λ2, . . . , λN . Hence, as λ(G) ≤ αD we have that λ(Gk) = λ(G)k ≤ αkDk as desired.

Now, we define the zig-zag product, which will be an unsymmetric binary function which given a D-regular graph on N vertices and a d-regular graph on D vertices gives a d2-regular graph on ND vertices. It will show to be more suited to our needs in improving a graphs expansion than powering, as the resulting graphs will be of bounded degree.

27 Definition 3.2.4 ([RVW02]). If G is a D-regular graph on [N] with rotation map

RotG and H is a d-regular graph on [D] with rotation map RotH then their zig-zag product G z H is defined to be the d2-regular graph on [N] × [D] whose rotation map

2 2 RotG z H : ([N] × [D]) × [d] −→ ([N] × [D]) × [d] is as follows:

0 0 • Let (a , i ) = RotH (a, i).

0 0 • Let (w, b ) = RotG(v, a ).

0 0 • Let (b, j ) = RotH (b , j).

0 0 • Set RotG z H ((v, a), (i, j)) = ((w, b), (j , i )).

Less formally, we can think of the construction of G z H as follows. First, we consider an edgeless graph with vertex set [N] × [D] gotten by replacing each vertex v of G with a vertex copy Hv of H. Next, for each neighbor w of v in G we construct a complete bipartite graph between d vertices of Hv and d vertices of Hw. We do so as follows: Suppose to get from v to w in G we leave along the labeled edge a0 and arrive

0 0 0 along the labeled edge b , that is, that RotG(v, a ) = (w, b ). Then we simply connect

0 all the vertices (v, a) in Hv, where a is a neighbor of a in H, to all the vertices (w, b)

0 in Hw, where b is a neighbor of b in H. Since H is d-regular we see that the resulting graph G z H is d2-regular, since for vertex (v, a) there are d choices for (v, a0) then

0 0 one choice for (w, b ) = RotG(v, a ) and finally d choices for (w, b). Additionally, from this we see that an edge in G z H corresponds to a walk of length three where the

first step is taken in H, the second in G and the third again in H.

28 Theorem 3.2.5 ([RVW02]). Let G be an (N, D, α)-graph and let H be an (D, d, β)- graph. Then G z H is an (ND, d2, φ(α, β))-graph where the function φ satisfies the following:

(1) If α < 1 and β < 1 then φ(α, β) < 1.

(2) φ(α, β) ≤ α + β.

1 2 (3) φ(α, β) ≤ 1 − 2 (1 − β ) · (1 − α).

Part (1) above gives us that the zig-zag product of two expander graphs is indeed another expander graph. And so the above result allows one to use the zig-zag product to explicitly construct families of expander graphs with constant degree.

4 1 For example, let D be a constant and H be an (D ,D, 4 )-graph. Where we note that there is a probabilistic proof that such an expander H exists and since D is constant we can find such a graph by an exhaustive search in constant time. Now, we define the family of graphs recursively:

2 G1 = H ,

2 Gn+1 = (Gn) z H.

4n 2 1 Theorem 3.2.6. Gn is an (D ,D , 2 )-graph for all n.

Proof. We proceed by induction on n. The base case n = 1 follows from the definition

2 4 2 1 as G1 = H which by Theorem 3.2.3 we know to be an (D ,D , 2 )-graph. Next, we 4n 2 1 assume that Gn is an (D ,D , 2 )-graph. Then again by Theorem 3.2.3 we know that 2 4n 4 1 2 (Gn) is an (D ,D , 4 )-graph and so, as the degree of (Gn) equals the size of H, 2 we can form Gn+1 = (Gn) z H, which by the part (2) of Theorem 3.2.5 will be an

4(n+1) 2 1 (D ,D , 2 )-graph.

29 3.3 Transforming graphs into expanders

This section gives a log-space transformation that essentially turns each one of the connected components of an arbitrary regular undirected graph into an expander.

This is the main part of Reingold’s USTCON algorithm.

Definition 3.3.1. On input G and H, where G is a D16-regular graph on [N] and H is a D-regular graph [D16], both given by their rotation maps, the transformation T outputs the rotation map of a graph G` defined as follows:

1 2` 1 • Set ` to be the smallest integer such that (1 − D16N 2 ) < 2 .

• Set G0 := G and define the family of graphs Gn recursively:

8 Gn+1 = (Gn z H) .

Let Tn(G, H) denote the graph Gn and T (G, H) = G`.

At first glance our choice of ` may seem strange but in light of Theorem 3.2.3

1 2` 1 2` we see that the condition that (1 − D16N 2 ) < 2 is the same as requiring that G 16 2` 1 be an (N, (D ) , 2 )-graph. Also, since log (1 − x) ≤ log (e)(−x) for all x ≤ 1 we observe that when D is fixed ` is O(log N). Inductively, we also see that each Gn is

16 16 n a D -regular graph on [N] × ([D ]) . And so when D is fixed we note that G` has poly(N) vertices.

The following lemma shows that when G is connected and non-bipartite and H is a good expander graph then the transformation T converts the inputed graph G into a good expander graph G`.

30 Lemma 3.3.2. Let G and H be inputs of T as in Definition 3.3.1. If G is connected

16 1 16 ` 16 1 and non-bipartite and H is an (D ,D, 2 )-graph then T (G, H) is an (N(D ) ,D , 2 )- graph.

16 1 Proof. We know from Theorem 2.2.9 that λ(G) ≤ D − N 2 and so by definition we 16 1 have that G0 = G is an (N,D , 1 − D16N 2 )-graph. Now, for n > 0 suppose that that 16 n−1 16 16 1 Gn−1 is an (N(D ) ,D , α)-graph. Then as H is an (D ,D, 2 )-graph by part (3) 16 n 2 1 of the zig-zag Theorem 3.2.5 we know that Gn−1 z H is an (N(D ) ,D , φ(α, 2 ))- 1 3 1 1 1 graph where φ(α, 2 ) ≤ 1− 8 ·(1−α) < 1− 3 ·(1−α). Now, if α ≤ 2 we see that φ(α, 2 ) < 5 8 16 n 16 1 6 and so by powering we have that Gn = (Gn−1 z H) is an (N(D ) ,D , 2 )-graph, 5 8 1 1 1 since ( 6 ) < 2 . Otherwise, in the case that 2 < α < 1 we observe that (1 − 3 · 4 8 16 n 16 2 (1 − α)) ≤ α and so we have that Gn = (Gn−1 z H) is an (N(D ) ,D , α )-graph.

16 n 16 2 1 Hence, we see that Gn is an (N(D ) ,D , max {α , 2 })-graph. Thus, by induction this is the case for n = 1, . . . , ` and so by our choice of ` we see that G` = T (G, H)

16 ` 16 1 is an (N(D ) ,D , 2 )-graph.

This lemma really shows how ingenuous and exact the above transformation is.

Namely, we see how the zig-zag product is applied in such a way that it condenses the exponential powering need to change an inputed graph into an expander in just a logarithmic number of steps.

The following lemma shows additionally that T operates separately on each con- nected component of the inputed graph. Where we say that a nonempty subset S of vertices corresponds to a connected component of the graph G if G|S, the subgraph of G induced by S, is connected and the set S is disconnected from the rest of G.

31 Lemma 3.3.3. Let G and H be inputs of T as in Definition 3.3.1. If S ⊆ [N] corresponds to a connected component of G then

T (G|S,H) = T (G, H)|S×([D16])` .

Proof. We show by induction that Tn(G|S,H) = Tn(G, H)|S×([D16])n . The base case n = 0 is trivial, since by definition T0(G|S,H) = G|S and T0(G, H)|S×([D16])0 =

G|S×([D16])0 = G|S. Now, we assume Tn(G|S,H) = Tn(G, H)|S×([D16])n . Next, take

16 n Sn = S × ([D ]) and Gn = Tn(G, H). Since Sn is disconnected from the rest

16 of Gn then by the definition of the zig-zag product we know that Sn × [D ] is

16 disconnected from the rest of Gn z H and that the edges incident to Sn × [D ] in

16 Gn z H are exactly as in Gn|Sn×[D ] z H. So by the definition of powering we now

16 8 know that Sn × [D ] is disconnected from the rest of (Gn z H) and that the edges

16 8 8 16 incident to Sn × [D ] in (Gn z H) are exactly as in (Gn|Sn×[D ] z H) . That is, that

Tn+1(G|S,H) = Tn+1(G, H)|S×([D16])n+1 . Thus, by induction the result follows.

We now show that when D is constant T can indeed be computed in log-space.

That is, we show that one can evaluate the rotation map RotG` of G` = T (G, H) for a specific vertex and edge label using space O(log N). The reason for this is that

computing RotGi+1 for each graph Gi+1 in the definition of T requires only a constant

number of operations. Specifically, each operation is either an evaluation of RotGi or something that requires a constant amount of space. Since the same space can be used for each one of these operations basically the only new space we need to compute

32 RotGi+1 is a counter of constant size which stores just exactly what operation is being computed.

Lemma 3.3.4. For every constant D the transformation T from Definition 3.3.1 can be computed in space O(log N) on inputs G and H, where G is a D16-regular graph on [N] and H is a D-regular graph on [D16].

Proof. We present an algorithm A which given the above graphs G and H computes

the rotation map RotG` of G` = T (G, H). Given G and H by their respective rotation maps on the read-only input tape A enumerates all values (¯v, a¯) in the domain of

RotG` , evaluates RotG` (¯v, a¯) and then prints [(¯v, a¯), RotG` (¯v, a¯)] on the output tape.

16 16 ` Since G` is a D -regular graph on [N] × ([D ]) then, as ` = O(log N) and D is fixed, we see that the length of each (¯v, a¯) is O(log N). Hence, we can enumerate all

these values in space O(log N). Additionally, we need to show that RotG` (¯v, a¯) can be computed in log-space for each specific (¯v, a¯) ∈ ([N] × ([D16])`) × [D16].

The algorithm A makes use of the following variables: v ∈ [N], which specifies

16 a vertex of G, and ` + 1 variables a0, a1, . . . , a` ∈ [D ], each specifying a vertex in H though sometimes a0 may specify an edge label of G. Also, we think of each a1, . . . , a` as corresponding to a sequence of 16 edge labels of H and so we denote each ai = (ki,1, . . . , ki,16). A begins for a specific (¯v, a¯) by setting (v, a0, a1, . . . , a`−1) =v ¯

and a` =a ¯. We now describe how A evaluates RotGi on the above described variables.

In the base case i = 0, RotG0 = RotG which is written on our input tape and can thus be evaluated in space O(log N), since we can simply search the input tape for

the desired entry. For i > 0, we compute RotGi as follows:

33 For j = 1 to 16

• Set (ai−1, ki,j) = RotH (ai−1, ki,j).

• If j is odd, recursively set

((v, a0, . . . , ai−2), ai−1) = RotGi−1 ((v, a0, . . . , ai−2), ai−1).

• If j = 16, reverse the order of the individual labels in ai. That is, set

(ki,1, . . . , ki,16) = (ki,16, . . . , ki,1).

We verify that this above process coincides with our above definition of T . When j = 1 we first set (ai−1, ki,1) = RotH (ai−1, ki,1), which corresponds to taking a step along an edge in H. Then as 1 is odd we recursively set ((v, a0, . . . , ai−2), ai−1) =

RotGi−1 ((v, a0, . . . , ai−2), ai−1), which corresponds to taking a step along an edge in the graph Gi−1. Moving on to when j = 2 all we do is set (ai−1, ki,2) = RotH (ai−1, ki,2), which again corresponds to taking a step along an edge in H. Thus, we see that for j = 1, 2 the above corresponds to what we know to be movement along a single edge in

Gi−1 z H. Repeating this process for j = 3 to 16 we see that we have effectively taken a walk of length 8 in Gi−1 z H determined by ai = (ki,1, . . . , ki,16) which corresponds

8 to moving along a single edge in Gi = (Gi−1 z H) . Finally, when j = 16 we reverse

the order of the individual labels in ai thus obtaining our desired output RotGi (¯v, a¯). The correctness of A follows since this corresponds exactly with the transformation

T from Definition 3.3.1.

We now deal with the space complexity of A. The depth of the above recursion is

` + 1 = O(log N) where each node of the recursion performs a constant number

34 of operations and makes a constant number of recursive calls. Hence, we can perform the above recursion in space O(log N). Additionally, all the basic operations of the algorithm, be it evaluating RotG or RotH or reversing the order of labels in the case when j = 16, can be performed in space O(log N). And so we have that the only space required after performing one of these basic operations is the space required to store the variables v, a0, a1, . . . , a` and the space required to maintain the recursion, both which we know to be O(log N). Thus, we see that the space complexity of A is

O(log N) and the lemma follows.

3.4 Reingold’s log-space algorithm for USTCON

Combining the results from the previous sections we are now able to present Rein- gold’s log-space algorithm for USTCON.

Theorem 3.4.1 ([Rei05]). USTCON ∈ L.

Proof. We present an algorithm A which takes as input an undirected graph G on [N], given by its adjacency matrix, along with two vertices s and t in [N]. A will output

‘connected’ if and only if there is a path between s and t in G. Most importantly, A will use space which is logarithmic in its input size, that is, A can be computed in space O(log N).

Taking n = 8 in Theorem 3.2.6 we see that for some constant De there exists an

16 1 ((De) ,De, 2 )-graph H. Since such an expander graph H exists A can obtain it by an exhaustive search in constant time using a constant amount of memory.

Let T be the log-space transformation given by Definition 3.3.1. Since T is

35 capable of transforming a given graph into a constant-degree expander, where we know how to solve st-connectivity in log-space, we would like to somehow apply T to G. In order to do this we must first modify our inputed graph G so that we can apply T . Specifically, we need to preprocess G into a new graph Greg which will be

16 a De -regular graph on [N] × [N] given by its rotation map. We accomplish this by replacing each vertex of G with an N and if there is an edge between v and w in G we connect the vertex (v, w) to the vertex (w, v). To meet quota we take the

16 rest of the edges to be self loops. The rotation map RotGreg : ([N] × [N]) × [De ] −→

16 ([N] × [N]) × [De ] is formally defined as follows:

0 0 • RotGreg ((v, w), 1) = ((v, w ), 2), where if w < N we take w = w + 1 and in the case that w = N we take w0 = 1.

0 0 • RotGreg ((v, w), 2) = ((v, w ), 1), where if w > 1 we take w = w − 1 and in the case that w = 1 we take w0 = N.

• In the case there is an edge between v and w in G then RotGreg ((v, w), 3) =

((w, v), 3). Otherwise, RotGreg ((v, w), 3) = ((v, w), 3).

• For i > 3, RotGreg ((v, w), i) = ((v, w), i).

16 Greg is by construction De -regular and all of its connected components are non- bipartite, since every vertex in Greg has self loops. Additionally, we observe that for every connected component S ⊆ [N] of G we have that S × [N] is a connected component in Greg. This is because for any vertex v ∈ [N] the set of vertices v × [N] all are contained in the same connected component of Greg, as they are connected by

36 a cycle, and as there is an edge between v × [N] and w × [N] in Greg if and only if there is an edge between v and w in G.

It is vital to note that the algorithm is not required to store this new graph Greg.

This is because we may decide adjacency in Greg by computing its rotation map

RotGreg , which only calls the adjacency function of the inputed graph G which was given as input and can be searched for the desired entry in log-space. Thus we see that this transformation from G given by its adjacency matrix to Greg given by its rotation map is computable in log-space.

Now, we are able to define Gexp = T (Greg,H) and ` = O(log N) as in Defini-

16 16 ` tion 3.3.1, where we obseve that Gexp is an De -regular graph on [N] × [N] × ([De ]) . Next, let S correspond to the connected component of G which contains the inputed vertex s. From above we know that S×[N] is a connected component of Greg and that

16 ` Greg|S×[N] is non-bipartite. And so by Lemma 3.3.3, we know that S × [N] × ([De ]) is a connected component of Gexp. Additionally, by Lemma 3.3.2 and Lemma 3.3.3

16 ` 16 1 we have that G | 16 ` is an (|S|N(D ) ,D , )-graph. exp S×[N]×([De ]) e e 2 Next, let A0 be the algorithm given in Theorem 3.1.2 which decides undirected st-connectivity in graphs where the connected component of the starting vertex is an

0 expander. Our algorithm A will now apply A on the graph Gexp and the vertices

0 `+1 0 `+1 0 0 0 s = (s, 1 ) and t = (t, 1 ). If A outputs that s and t are connected in Gexp then A will output ‘connected’, that is, that s and t are connected in G. Otherwise,

A will output that s and t are not connected.

The algorithm A is log-space since it consist of a constant number of log-space procedures:

37 • The transformation from G given by its adjacency matrix to Greg given by its rotation map.

• The transformation from Greg to Gexp via T , whose rotation map is computable in log-space from Lemma 3.3.4.

• The algorithm A0, which is log-space from Theorem 3.1.2.

That A solves USTCON correctly follows from the observation that s0 ∈ S × [N] ×

16 ` ([De ]) which is a connected component of Gexp directly corresponding to the con- nected component S of G which contains s. And so we see that s0 and t0 are con- nected in G if and only if s and t are connected in G. Since G | 16 ` is an exp exp S×[N]×([De ]) 16 ` 16 1 0 (|S|N(De ) ,De , 2 )-graph by Theorem 3.1.2 we know that A will output ‘connected’ 0 0 if and only if s and t are connected in Gexp. Therefore, we see that the algorithm A correctly determines USTCON in log-space.

38 CHAPTER 4

CONSEQUENCES OF REINGOLD’S ALGORITHM

4.1 SL=L

Essentially SL was defined by Lewis and Papadimitriou [LP82] to be the complexity class for which USTCON would be complete. Hence, another way of stating Rein- gold’s Theorem 3.4.1 that USTCON ∈ L is the following theorem.

Theorem 4.1.1 ([Rei05]). SL = L.

As a consequence of this result we see that the class hierarchy surrounding loga- rithmic space is now

L = SL ⊆ RL ⊆ NL ⊆ L2.

We should also note that in a more recent paper Rozenman and Vadham [RV05] give a different proof of Reingold’s result using a new idea of derandomized graph squaring. Additionally, Reingold, Trevisan and Vadham [RTV05] give a new complete problem for RL which is well suited to the techniques applied in Reingold’s original algorithm and thus has the potential to further collapse the above class hierarchy surrounding logarithmic space.

39 4.2 Additional problems solvable in log-space

Additionally, from Theorem 4.1.1 we have that every problem which is complete or contained in SL can thus be solved in log-space. Alvarez` and Greenlaw [AR00] presented a long list of such problems of which we now present a few of graph theoretic interest.

• Given an undirected graph G, two vertices s and t and a natural number k,

determine if there k vertex disjoint paths from s to t.

• Given an undirected graph G and a natural number k, determine if G has k

connected components.

• Given an undirected graph G, determine if G is a bipartite graph, that is,

determine if G is 2-colorable.

• Given an undirected graph G, determine if G is a chordal graph.

• Given an undirected graph G, determine if G is an interval graph.

• Given an undirected graph G, determine if G is a comparability graph.

• Given an undirected graph G, determine if G is a split graph.

• Given an undirected graph G, determine if G is a permutation graph.

• Given an undirected graph G whose vertices have bounded degree, determine

if G is a planar graph.

40 BIBLIOGRAPHY

[AKL79] R. Aleliunas, R. Karp, R. Lipton, L. Lovasz´ and C. Rackoff, Random walks, universal traversal sequences, and the complexity of maze problems, In 20th Annual Symposium on Foundations of Computer Science, pages 218-223, San Juan, Puerto Rico, 29-31 October 1979, IEEE.

[AR00] C. Alvarez` and R. Greenlaw, A compendium of problems complete for symmetric logarithmic space, Computational Complexity, 9: 73-95, 2000.

[Alo86] N. Alon, Eigenvalues and expanders, Combinatorica, 6(2): 83-96, 1986.

[AM85] N. Alon and V. Milman, λ1, isoperimetric inequalities for graphs, and superconcentrators, Journal of Combinatorial Theory: Series B, 38(1): 73- 88, 1985.

[AS00] N. Alon and B. Sudakov, Bipartite subgraphs and the smallest eigen- value, Combinatorics, Probability & Computing, 9(1), 2000.

[ATS00] R. Armoni, A. Ta-Shma, A. Wigderson and S. Zhou, An O(log n4/3) space algorithm for (s, t) connectivity in undirected graphs, Journal of the ACM, 47(2): 294-311, 2000.

[Chu89] F. R. K. Chung, Diameters and Eigenvalues. Journal of the American Mathematical Society, 2(2): 187-196, 1989.

[Chu97] F. R. K. Chung, Spectral , American Mathematical Society, Providence, RI, 1997.

[Dod84] J. Dodziuk, Difference equations, isoperimetric inequality and transience of certain random walks. Transactions of the American Mathematical Soci- ety, 284(2): 787-794, 1984.

[HLW06] S. Hoory, N. Linial and A. Wigderson, Expander graphs and their applications, Bulletin of the American Mathematical Society, 43(4): 439- 561, 2006.

41 [Imm88] N. Immerman, Nondeterministic space is closed under complementation, SIAM Journal on Computing, 17: 935-938, 1988.

[LP82] H. Lewis and C. Papadimitriou, Symmetric space-bounded computa- tion, Theoretical Computer Science, 19: 161-187, 1982.

[LW01] J. van Lint and R. Wilson, A Course in Combinatorics, Cambridge University Press, Cambridge, UK, 2001.

[LPS88] A. Lubotzky, R. Philips and P. Sarnak, Ramanujan graphs, Combi- natorica, 8(3): 261-277, 1988.

[Mar73] G. Margulis, Explicit constructions of expanders, Problemy Peredacˇi In- formacii, 9(4): 71-80, 1973.

[NSW89] N. Nisan, E. Szemeredi and A. Wigderson, Undirected connectivity in O(log n1.5) space, In Proceedings of the 30th FOCS, pages 24-29, Research Triangle Park, North Carolina, 30 October-1 November 1989, IEEE.

[Pap94] C. H. Papadimitriou, Computational Complexity, Addison-Wesley Pub- lishing Company, Reading, MA, 1994.

[Rei05] O. Reingold, Undirected ST-connectivity in log-space, In Proceedings of the 37th Annual ACM Symposium on Theory of Computing, pages 376-385, 2005.

[RVW02] O. Reingold, S. Vadhan and A. Wigderson, Entropy waves, the zig- zag graph product, and new constant-degree expanders, Annals of Mathe- matics, 155(1): 157-187, 2002.

[RTV05] O. Reingold, L. Trevisan and S. Vadhan, Pseudorandom walks in biregular graphs and the RL vs. L problem, Electronic Colloquium on Com- putational Complexity, Technical Report TR05-022, February 2005.

[RV05] E. Rozenman and S. Vadham, Derandomized squaring of graphs, In Proceedings of the 8th International Workshop on Randomization and Com- putation (RANDOM), volume 3642 of Lecture Notes in Computer Science, pages 436-447, 2005.

[Sav70] W.J. Savitch, Relationships between nondeterministic and deterministic tape complexities, J. Comput. System. Sci., 4: 177-192, 1970.

42