18.6 KB · commit a9602da
Many problems can be modeled with paths formed by traveling along the edges of graphs. For instance, the problem of determining whether a message can be sent between two computers using intermediate links can be studied with a graph model. Problems of efficiently planning routes for mail delivery, garbage pickup, diagnostics in computer networks, and so on can be solved using models that involve paths in graphs.
Informally, a path is a sequence of edges that begins at a vertex of a graph and travels along edges of the graph, always connecting pairs of vertices.
In the simple graph shown in Figure 1, a,d,c,f,e is a simple path of length 4, because {a,d},{d,c},{c,f}, and {f,e} are all edges. However, d,e,c,a is not a path, because {e,c} is not an edge. The path b,c,f,e,b is a circuit of length 4. The path a,b,e,d,a,b is not a simple path, because the edge {a,b} is traversed twice. ◀
Figure 1 — A Simple Graph.
In an acquaintanceship graph, a path between two people represents a chain of people linking these two people, where two people adjacent in the chain know one another. For example, in Figure 6 in Section 10.1, there is a chain of six acquaintances linking Kamini and Ching: Kamini, Jan, Paula, Todd, Kamlesh, Ching.
A famous social science experiment conducted by Stanley Milgram in the 1960s led to the conventional wisdom that there is a chain of at most six acquaintances linking any two people in the world. This is the origin of the phrase "six degrees of separation." More recently, this concept has been explored in games such as finding the "Kevin Bacon number" of an actor, which is the length of a shortest path from that actor to Kevin Bacon in the Hollywood graph. ◀
In the collaboration graph of mathematicians, a path between two mathematicians represents a chain of coauthors linking them. The Erdős number of a mathematician is the length of a shortest path between that mathematician and the prolific Hungarian mathematician Paul Erdős. Erdős had an Erdős number of 0. People who published a joint paper with Erdős have an Erdős number of 1. Those who did not publish with Erdős, but published with someone who did, have an Erdős number of 2, and so on. ◀
When does a computer network have the property that every pair of computers can communicate through intermediate links? This question can be answered by studying connectedness in graphs.
The graph G1 in Figure 2 is connected, because for every pair of distinct vertices there is a path between them (the reader should verify this). However, the graph G2 in Figure 2 is not connected. For instance, there is no path in G2 between vertices a and d. ◀
Figure 2 — The Graphs G1 and G2.
Proof: Let u and v be distinct vertices of the connected undirected graph G=(V,E). Because G is connected, there is at least one path between u and v. Let x0,x1,…,xn, where x0=u and xn=v, be a path of least length between u and v. We will show that this path is simple.
Suppose that this path is not simple. Then there is an edge that appears more than once in the path, so there are vertices xi and xj with i<j such that the edge between xi and xi+1 is the same as the edge between xj and xj+1. (Or, in a simple graph, two vertices are identical, xi=xj for some 0≤i<j≤n.) Then the path obtained by deleting the subpath xi,…,xj has length less than n and connects u and v. This contradicts the choice of x0,x1,…,xn as a path of least length. Therefore, the path of least length between u and v is simple. ■
A graph that is not connected has two or more connected subgraphs, each of which is connected. A connected component of a graph G is a connected subgraph of G that is not a proper subgraph of any connected subgraph of G. That is, a connected component of a graph G is a maximal connected subgraph of G. A graph G that is not connected has two or more connected components that are disjoint and have G as their union.
What are the connected components of the graph H shown in Figure 3?
Solution: The graph H is the union of three disjoint connected subgraphs H1,H2, and H3, shown in Figure 3. These three subgraphs are the connected components of H. ◀
Figure 3 — The Graph H and Its Connected Components H1,H2, and H3.
In the call graph representing phone calls during a 20-day period described in Example 4 of Section 10.1, there were 290 million vertices and 4 billion edges. It was found that this graph had many connected components, but a single giant connected component contained more than 260 million vertices. ◀
It is often important to know how connected a graph is. If a graph represents a computer network, we may want to know how many computers or communication links can fail before the network becomes disconnected.
Sometimes the removal of a single vertex produces a subgraph that has more connected components than the original graph. Such a vertex is called a cut vertex (or articulation point). The removal of a cut vertex from a connected graph produces a subgraph that is not connected. Analogously, an edge whose removal produces a graph with more connected components than the original graph is called a cut edge (or bridge).
Find the cut vertices and cut edges in the graph G1 shown in Figure 4.
Solution: The cut vertices of G1 are b,c, and e. The removal of one of these vertices disconnects the graph and increases the number of connected components. The cut edges of G1 are {a,b} and {c,e}. The removal of either of these edges disconnects the graph. ◀
Figure 4 — Some Connected Graphs.
Not all connected graphs have cut vertices. For example, the complete graph Kn, where n≥3, has no cut vertices. In such graphs, we may need to remove a set of vertices to disconnect the graph.
A subset of vertices V′ of the vertex set V of a connected graph G=(V,E) is called a vertex cut, or separating set, if G−V′ is disconnected. For instance, in the graph in Figure 1, the set {b,c,e} is a vertex cut with three vertices. The vertex connectivity of a noncomplete connected graph G, denoted by κ(G), is the minimum number of vertices in a vertex cut. When G is a complete graph, it has no vertex cut, and we define κ(Kn)=n−1. A graph is called k-connected (or k-vertex-connected) if κ(G)≥k.
Find the vertex connectivity for each of the graphs in Figure 4.
Solution: Each of the five graphs in Figure 4 is connected and has more than one vertex, so each has vertex connectivity of at least 1.
We can also disconnect a graph by removing edges. An edge cut of a connected graph G=(V,E) is a set of edges E′ such that G−E′ is disconnected. The edge connectivity of a connected graph G, denoted by λ(G), is the minimum number of edges in an edge cut. A graph is k-edge-connected if λ(G)≥k.
Find the edge connectivity of each of the graphs in Figure 4.
Solution: Each of the five graphs in Figure 4 is connected and has more than one vertex, so each has edge connectivity of at least 1.
For any connected graph G, the vertex connectivity, edge connectivity, and minimum degree satisfy the inequality: κ(G)≤λ(G)≤v∈Vmindeg(v).
We now consider connectedness in directed graphs.
Clearly, any directed graph that is strongly connected is also weakly connected.
The subgraphs of a directed graph G that are strongly connected and are not contained in larger strongly connected subgraphs, that is, the maximal strongly connected subgraphs of G, are called the strongly connected components of G.
Are the directed graphs G and H shown in Figure 5 strongly connected? Are they weakly connected?
Solution: G is strongly connected because there is a path between any two vertices in the directed graph: a,b,c,d,e,a is a directed cycle that visits all five vertices. Hence, G is also weakly connected.
H is not strongly connected. There is no directed path from a to b, because no directed edges leave a. However, H is weakly connected, because its underlying undirected graph is connected. ◀
The graph H in Figure 5 has three strongly connected components: the subgraph consisting of the vertex a; the subgraph consisting of the vertex e; and the subgraph consisting of the vertices b,c, and d together with the directed edges (b,c),(c,d), and (d,b). ◀
Figure 5 — The Directed Graphs G and H.
The Web graph is a directed graph where vertices represent Web pages and directed edges represent hyperlinks. It is not strongly connected. Studies of the Web graph have shown that it has a large strongly connected core (SCC) containing tens of millions of pages, together with an IN component (pages that can reach the SCC but cannot be reached from it) and an OUT component (pages reachable from the SCC but that cannot reach it). ◀
Paths and circuits can help determine whether two graphs are isomorphic. The existence of a simple circuit of a particular length is a graph invariant.
Determine whether the graphs G and H shown in Figure 6 are isomorphic.
Figure 6 — The Graphs G and H.
Solution: Both G and H have six vertices and eight edges. Each has two vertices of degree 2 and four vertices of degree 3. However, in G, there is a simple circuit of length 3, namely u1,u2,u6,u1, whereas H has no simple circuit of length 3 (as the reader should verify). Because the existence of a simple circuit of length 3 is a graph invariant, G and H are not isomorphic. ◀
Determine whether the graphs G and H shown in Figure 7 are isomorphic.
Figure 7 — The Graphs G and H.
Solution: Both G and H have five vertices and six edges. Both have two vertices of degree 2 and three vertices of degree 3. Both have simple circuits of length 3, 4, and 5.
However, in G, the two vertices of degree 2 are u1 and u3, which are not adjacent. In H, the two vertices of degree 2 are v1 and v2, which are adjacent. The distance between the vertices of degree 2 is a graph invariant. Therefore, G and H are not isomorphic. ◀
The number of paths between two vertices in a graph can be determined using the adjacency matrix of the graph.
Proof: We will use mathematical induction. Basis step: For r=1, the number of paths of length 1 from vi to vj is the number of edges from vi to vj. This is by definition the (i,j)th entry of A=A1.
Inductive step: Assume that the (i,j)th entry of Ar is the number of paths of length r from vi to vj, where r is a positive integer. We must show that the (i,j)th entry of Ar+1 is the number of paths of length r+1 from vi to vj.
A path of length r+1 from vi to vj consists of a path of length r from vi to some vertex vk, followed by an edge from vk to vj. By the induction hypothesis, the number of paths of length r from vi to vk is the (i,k)th entry of Ar, denoted aik(r). The number of edges from vk to vj is the (k,j)th entry of A, denoted akj. By the product rule, the number of paths of length r+1 from vi to vj that have vk as their next-to-last vertex is aik(r)akj.
By the sum rule, the total number of paths of length r+1 from vi to vj is k=1∑naik(r)akj. This sum is precisely the (i,j)th entry of the product matrix Ar⋅A=Ar+1. This establishes the inductive step and completes the proof. ■
How many paths of length four are there from a to d in the simple graph G in Figure 8?
Figure 8 — The Graph G.
Solution: The adjacency matrix of G with respect to the ordering a,b,c,d is
A=0110100110010110.Computing A4, we find
A4=8008088008808008.Because the (1,4)th entry of A4 is 8, there are exactly eight paths of length four from a to d. By inspection of the graph, we see that a,b,a,b,d;a,b,a,c,d;a,b,d,b,d;a,b,d,c,d; a,c,a,b,d;a,c,a,c,d;a,c,d,b,d;a,c,d,c,d are the eight paths of length four from a to d. ◀
Theorem 2 can be used to find the length of the shortest path between two vertices of a graph, and it can also be used to determine whether a graph is connected.