If the edges in a graph Γ represent connections, it is obvious to ask whether Γ as a whole is “connected”. There are two seemingly different ways of making this precise; today we introduce these and show that they are the same.

It may be easiest to define what it means for a graph Γ to be disconnected.

Definition: Disjoint union

Given two graphs Γ1 and Γ2, the disjoint union Γ1Γ2 is obtained by taking the disjoint union of both the vertices and edges of Γ1 and Γ2. So Γ1Γ2 consists of a copy of Γ1 and a copy of Γ2, with no edges in between the two graphs.

Definition: Disconnected

A graph Γ is disconnected if we can write Γ=Γ1Γ2 for two proper (i.e., not all of Γ) subgraphs Γ1 and Γ2.

It then makes sense to say that Γ is connected if it is not disconnected. However, the more intuitive notion of being connected is that “you can get from any vertex to any other”, which we now make precise.

Walks, Trails, Paths

Definition

A walk in a graph Γ is a sequence

v0,e1,v1,e2,v2,,vn1,en,vn

where

  • the vi are vertices
  • the ej are edges
  • edge ej goes between vertices vj1 and vj

Note that, when the graph Γ does not have multiple edges, it is enough to record just the vi, but if Γ has multiple edges that just knowing the vertices does not determine the walk.

We say that the walk is between vertices a and b if a=v0 to vertex b=vn. Thus, it is natural to say that a graph Γ is connected if there is a walk between any two vertices a,bΓ. We now show that this agrees with our previous definition of connected.

Lemma

The following are equivalent:

  1. Γ is connected.
  2. There is a walk between any two vertices v,wV(Γ)

Proof

1 implies 2: Supppose that Γ is connected, and let v,wV(Γ); we want to show that there is a walk from v to w.

Define SV(Γ) to be the set of all vertices uV(Γ) so that there is a walk from v to u; we want to show that wS.

First, observe that there are no edges from S to V(Γ)S. Suppose that e was an edge between aS and bΓS. Since aS, by the definition of S there is a walk v=v0v1v2vm=a from v to a. We can add the edge e to the end of the walk, to get a walk from v to b, and hence by definition bS.

Now suppose that wS. Then S and V(Γ)S are both nonempty, and by the above there are no edges between them, and so Γ is not connected, a contradiction.

To prove 2 implies 1, we prove the contrapositive. If Γ is not connected, then there are two vertices v,wV(Γ) so that there is no walk from v to w.

Suppose that Γ=Γ1Γ2, and pick vV(Γ1),wV(Γ2). Any walk from v to w starts in V(Γ1) and ends in V(Γ2), and so at some point there must be an edge from a vertex in Γ1 to a vertex in Γ2, but there are no such edges

Types of Walks

Many questions in graph theory ask whether or not a walk of a certain type exists on a graph: we introduce some notation that will be needed for these questions.

We say a walk is closed if it starts and ends on the same vertex; i.e., v0=vn. The length of a walk is n, the number of edges in it. The distance between two vertices v and w is the length of the shortest walk from v to w, if one exists, and if one does not exist.

Walks, trails and paths

  • If the edges ei of the walk are all distinct, we call it a trail
  • If the vertices vi of the walk are all distinct (except possibly v0=vm), we call the walk a path. The exception is to allow for the possibility of closed paths.

Lemma

Let v,wV(Γ). The following are equivalent:

  1. There is a walk from v to w.
  2. There is a trail from v to w
  3. There is a path from v to w.

Proof

Obviously, 3 implies 2 which implies 1, as any path is a trail, and any trail is a walk.

That 1 implies 3 is intuitively obvious: if you repeat a vertex, then you’ve visited someplace twice, and weren’t taking the shortest route. Let’s make this argument mathematically precise.

Suppose we have a walk v=v0,e1,,em,vm=w that is not a path. Then, we must repeat some vertex, say vi=vk, with i<k. Then we can cut out all the vertices and edges between vi and vk to obtain a new walk

v=v0,e1,v1,,ei,vi,ek+1,vk+1,ek+2,vk+2,,vm.

Since i<k, the new walk is strictly shorter than our original walk. Since the length of a walk is finite, if we iterate this process the result must eventually terminate. That means all our vertices are distinct, and hence is a path.