



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Notes; Class: Discrete Math/Functional Prog; Subject: Computer Science; University: Wheaton College; Term: Unknown 1989;
Typology: Study notes
1 / 5
This page cannot be seen from the preview
Don't miss anything!
A graph G = (V, E) is a pair of finite sets, a set V of vertices (singular vertex ) and a set E of pairs graph of vertices called edges. We will typically write V = {v 1 , v 2 ,... , vn} and E = {e 1 , e 2 ,... , em} where vertex each ek = (vi, vj ) for some vi, vj ; in that case, vi and vj are called end points of the edge ek. Graphs edge are drawn so that vertices are dots and edges are line segments or curves connecting two dots.^ end points We call the edges pairs of vertices for lack of a better term; a pair is generally considered a two-tuple (in this case, it would be an element of V × V ); moreover, we write edges with parentheses and a comma, just as we would with tuples. However, we mean something slightly different. First, tuples are ordered. Second, an edge as a pair of vertices is not unique. An edge (vi , vj ) is incident on its end points vi and vj ; we also say that it connects them. If incident vertices vi and vj are connected by an edge, they are adjacent to one another. If a vertex is adjacent connects to itself, that connecting edge is called a self-loop. If two edges connect the same two vertices, then adjacent those edges are parallel to each other. Below left, e 1 is incident on v 1 and v 4. e 10 connects v 7 and self-loop v 6. v 9 and v 6 are adjacent. e 8 is a self-loop. e 4 and e 5 are parallel. parallel
9
v
v
v
v v
4
e e e e e e
e
e
1
3
2
e
4
6 7
9
11
13
14
8
e
e
1 v 5
3
e
v (^2) 5
v (^6) 10 v 7
e (^12) e
8
9
v
v
v
v v
4
e e e e e e
e
e
1
3
2
e
4
6 7
9
11
13
14
8
e
e
1 v 5
3
e
v (^2) 5
v (^6) 10 v 7
e (^12) e
8 sample graph subgraph that happens to be simple
The degree deg(v) of a vertex v is the number of edges incident on the vertex, with self-loops degree
counted twice. deg(v 1 ) = 2, deg(v 5 ) = 3, and deg(v 2 ) = 4. A subgraph of a graph G = (V, E) subgraph is a graph G′^ = (V ′, E′) where V ′^ ⊆ V and E′^ ⊆ E (and, by definition of graph, for any edge (vi, vj ) ∈ E′, vi, vj ∈ V ′). A graph G = (V, E) is simple if it contains no parallel edges or self- simple loops. The graph ({v 1 , v 2 , v 3 , v 4 , v 5 }, {e 1 , e 2 , e 3 , e 4 , e 6 }), above right, is a simple subgraph of the graph shown. A simple graph G = (V, E) is complete if for all vi, vj ∈ V , the edge (vi, vj ) ∈ E. The subgraph complete ({v 7 , v 8 , v 9 }, {e 11 , v 12 , v 13 }) is complete. The complement of a simple graph G = (V, E) is a graph G = (V, E′) where for vi, vj ∈ V , (vi , vj ) ∈ E′^ if (vi, vj ) ∈/ E; in other words, the complement has all^ complement the same vertices and all (and only) those possible edges that are not in the original graph. The com- plement of the subgraph ({v 3 , v 4 , v 6 , v 7 }, {e 6 , e 7 , e 10 }) is ({v 3 , v 4 , v 6 , v 7 }, {(v 3 , v 7 ), (v 7 , v 4 ), (v 3 , v 6 )}, as shown below. Recall that we have defined complete and complement only in terms of simple graphs, so self-loops are not considered.
7
v
v
4
e
e
6 7
e v (^3)
6 10 v (^7)
v
v
3
4
v
6
v
A walk from vertex v to vertex w, v, w ∈ V , is a sequence alternating between vertices in V walk and edges in E, written v 0 e 1 v 1 e 2... vn− 1 envn where v 0 = v and vn = w and for all i, 1 ≤ i < n, ei = (vi− 1 , vi). (If a graph is simple, then it is possible to omit the edges when describing the path.) v is called the initial vertex and w is called the terminal vertex. A walk is trivial if it contains only initial
terminal
trivial
one vertex and no edges; otherwise it is nontrivial. The length of a walk is the number of edges
length
(not necessarily distinct, since an edge may appear more than once). In the graph below, some examples of non-trivial walks are v 1 e 1 v 2 e 4 v 6 e 9 v 8 e 11 v 7 e 10 v 6 e 8 v 9 with length 6, v 5 e 14 v 15 with length 1, and v 11 e 21 v 12 e 17 v 9 e 18 v 13 e 22 v 12 e 17 v 9 e 18 v 13 e 23 v 14 with length 7.
15
v v (^) v v v
v
v v v (^) v v
e e e
e e e
e e e e e
e e e (^) e
e e e
e
1 2 3 4 5
6
8
9 10 (^11 14 )
1 2 3 (^5 )
7
e
e
9
10 11 12 13 14
16
17 18 20 23
v 7
e^ e 8
4
v
22 v^13
v 12 21
19
A graph is connected if for all v, w ∈ V , there exists a walk in G from v to w. This graph is not connected connected, since no walk exists from v 5 or v 15 to any of the other vertices. However, the subgraph excluding v 5 , v 15 , and e 14 is connected. A path is a walk that does not contain a repeated edge. v 1 e 1 v 2 e 4 v 6 e 9 v 8 e 11 v 7 e 10 v 6 e 8 v 9 is a path, path but v 11 e 21 v 12 e 17 v 9 e 18 v 13 e 22 v 12 e 17 v 9 e 18 v 13. is not. If the walk contains no repeated vertices, except possibly the initial and terminal, then the walk is simple. v 1 e 1 v 2 e 4 v 6 e 9 v 8 e 11 v 7 e 10 v 6 e 8 v 9 is not simple, simple since v 6 occurs twice. Its subpath v 8 e 11 v 7 e 10 v 6 e 8 v 9 is simple. If v = w (that is, the initial and terminal vertices are the same), then the walk is closed. A circuit closed
circuit
is a closed path. A cycle is a simple circuit. In the earlier example, v 6 e 9 v 8 e 11 v 7 e 12 v 10 e 16 v 8 e 15 v 9 e 8 v 6
cycle
is a circuit, but not a cycle, since v 8 is repeated. v 2 e 4 v 6 e 8 v 9 e 17 v 12 e 7 v 2 is a cycle.
This theorem is almost obvious now. All we need to do is pick any vertex to begin with, and travel out by any edge. For ever vertex we get to, we just leave by the edge other than the one we entered.
start here
Don’t let this reasoning by example blind you to one special case:
Ready to prove?
Proof. Suppose G = (V, E) is a connected graph and for all v ∈ V , deg(v) = 2. First suppose |V | = 1, that is, there is only one vertex, v. Since deg(v) = 2, this implies that there is only one edge, e = (v, v). Then the cycle vev comprises the entire graph.
This looks like the beginning of a proof by induction, but actually it is a traditional division into cases. We are merely getting a special case out of the way. We want to use the fact that there can be no self-loops, but that is true only if there are more than one vertex.
Next suppose |V | > 1. By the exercise below, G has no self-loops.
We’ll leave that part for you.
Then construct a walk c in this manner: Pick a vertex v 1 ∈ V and an edge e 1 = (v 1 , v 2 ). Since deg(v 1 ) = 2, e must exist, and since G contains no self-loops, v 1 6 = v 2.
1 v 1
v 2 e
Since deg(v 2 ) = 2, there exists another edge, e 2 = (v 2 , v 3 ) ∈ E.
2
v 1
v 2 e 1
e v 3
Continue this process until we reach a vertex already visited, so that we can write c = v 1 e 1 e 2 v 3... ex− 1 vx where vx = vi for some i, 1 ≤ i < x. We will reach such a vertex eventually because V is finite. Only one vertex in c is repeated, since reaching a vertex for the second time stops the building process. Hence c is simple. Since we never repeat a vertex (until the last), each edge chosen leads to a new vertex, hence no edge is repeated in c, so c is a path. We are always choosing the edge other than the one we took into a vertex, so i 6 = x − 1. Suppose i 6 = 1. Since no other vertex is repeated, vi− 1 , vi+1, and vx− 1 are distinct. Therefore, distinct edges (vi− 1 , vi), (vi, vi+1), and (vx− 1 , vi) all exist, and so deg(vi) ≥ 3. Since deg(vi ) = 2, this is a contradiction. Hence i = 1. Moreover, v 1 = vx and c is closed. As a closed, simple path, c is a cycle. Suppose that a vertex v ∈ V is not in c, and let v′^ be any vertex in c. Since G is connected, there must be a walk, c′^ from v to v′, and let edge e′^ be the first edge in c′ (starting from v′) that is not in c, and let v′′^ be an endpoint in c′^ in c. Since two edges incident on v′′^ occur in c, accounting for e′^ means that deg(v′′) ≥ 3. Since deg(vi ) = 2, this is a contradiction. Hence there is no vertex not in c. Suppose that an edge e ∈ E is not in c, and let v be an endpoint of e. Since v is in the cycle, there exist distinct edges e 1 and e 2 in c that are incident on v, implying deg(v) ≥ 3. Since deg(v) = 2, this is a contradiction. Hence there is no edge not in c. Therefore, c is a cycle that comprises the entire graph, and G is a cycle. 2
Here’s a summary of the terms:
simple (of a graph) no self loops or parallel edges walk an alternating sequence of vertices and edges, starting and ending on a vertex path a walk without a repeated edge simple (of a path) no repeated vertex (except possibly the initial and terminal being the same) closed having the same vertex for the initial and terminal vertex circuit a closed path cycle a simple circuit Euler circuit a circuit containing every edge in the graph Hamiltonian cycle a cycle containing every vertex in the graph
Exercise. Show that if G is connected, for all v ∈ V, deg(v) = 2, and |V | > 1, then G has no self-loops.