Mathematics 223b
Second Midterm Exam
March 10, 2007
Instructions: Print your name and your instructor’s name on the SCANTRON answer
sheet. Sign the SCANTRON answer sheet, and mark your student number and section on
the SCANTRON answer sheet. Use a PENCIL to mark your answers to questions 1–23
on the SCANTRON•answer sheet, and as well, circle your answers on the question sheet.
•
•
s
•
•
G1 :
G2 :
•
•
•
•
•
t
•
•
•
•
•
•
•
•
G3 :
•
G4 :
G5 :
•
•
•
G6 :
•
•
•
•
•
•
•
•
•
A1. [2 marks ] In the graph G1 , how many paths are there from s to t?
A: 3
B: 4
Solution:
C: 5
D: 6
•
E: None of A, B, C, D
•
s
•
s
•
•
•
•
s
•
•
•
t
•
•
s
•
•
•
t
•
•
t
s
•
•
•
•
t
•
•
•
•
Thus there are 5 paths from s to t in G1 . The answer is C.
t
A2. [2 marks ] Which of the following statements concerning the graphs drawn above is true?
(i) No two of the graphs are isomorphic.
(ii) G3 and G4 are isomorphic, and no other isomorphisms exist between
pairs of the above graphs.
(iii) G3 and G6 are isomorphic, and no other isomorphisms exist between
pairs of the above graphs.
(iv) G4 and G6 are isomorphic, and no other isomorphisms exist between
pairs of the above graphs.
(v) G3 , G4 , and G6 are all isomorphic.
A: (i)
B: (ii)
C: (iii)
D: (iv)
E: (v)
Solution: If two graphs are isomorphic, then they have identical degree sequences. The degree sequences
of G1 , G2 , G3 , G4 , G5 , and G6 , respectively, are (3, 3, 3, 3, 2), (3, 3, 3, 3, 3), (4, 3, 3, 3, 3), (4, 3, 3, 3, 3),
(3, 3, 3, 3, 3, 3), and 4, 3, 3, 3, 3). The only possiblity would be that G3 , G4 , and G6 are isomorphic. In fact,
2
if we redraw each of G3 and G4 , placing the vertex of degree 4 inside the 4-cycle, we obtain the diagram
of G6 . Thus G3 , G4 , and G6 are isomorphic.
The answer is E.
A3. [2 marks ] Exactly which of the graphs G1 , G2 , G3 , G4 , G5 and G6 are regular?
A: G2 , G3 , G4
B: G2
C: G2 , G5
D: G5
E: G2 , G5 , G6
Solution: G1 has a vertex of degree 2 and a vertex of degree 3, so G1 is not regular. G2 = K5 is 4-regular.
Each of G3 and G4 has a vertex of degree 3 and a vertex of degree 4, so neither G3 nor G4 is regular.
G5 = K3,3 is 3-regular. Finally, G6 has a vertex of degree 3 and a vertex of degree 4, so G6 is not regular.
Thus G2 and G5 are regular, and the others are not. The answer is C.
A4. [2 marks ] Exactly which of the graphs G1 , G2 , G3 , G4 , G5 and G6 are bipartite?
A: G1
B: G3
C: G4
D: G5
E: None of them
Solution: Recall that a non-null graph is bipartite if and only if it is without cycles of odd length. Since
each graph except G5 actually has a 3-cycle, while G5 = K3,3 , only G5 is bipartite.
The answer is D.
A5. [2 marks ] What is τ (G1 ), the number of spanning trees of G1 ?
A: 16
B: 24
C: 32
D: 64
E: None of A, B, C, D
Solution: In the computation that follows, we utilize the fact that after the first step, the graph obtained
by deleting e has the vertex of degree 1 joined by a cut-edge to the remainder of the graph, to conclude
that the number of spanning trees of G − e is the product of the number of spanning trees of the two
components that result when the cut-edge is deleted. We also use the fact that in the “eyeglass” graph,
the middle vertex is a cut-vertex and so we have a product representation for the number of spanning
trees of the “eyeglass” graph.
e
•
•
τ
•
•
•
=τ
•
•
e
•
•
= τ (C4 ) + τ
•
τ ( • ) + τ (K4 )
v
•
•
+ 44−2
= 4 + (2)(2) + 42 = 24.
The answer is B.
A6. [2 marks ] In this question, G denotes a simple graph with n vertices and m edges. Exactly
which of the following statements are true?
(i) If G is connected, then n ≥ m − 1.
(ii) m ≥ n(n − 1)/2.
(iii) If G is connected and every vertex of degree greater than 1 is a
cut-vertex, then G is a tree.
A: (i)
B: (ii)
C: (iii)
D: (i), (ii)
E: None of A, B, C, D
Solution: (i) false. In fact, we must have m
≥ n − 1.
(ii) false. In fact, we must have m ≤ n2 = n(n − 1)/2.
(iii) false. For consider a 3-cycle with a vertex of degree 1 attached to each vertex of the 3-cycle. Each of
the three vertices of the 3-cycle are cut-vertices, the graph is connected, and the remaining three vertices
are all degree 1, yet the graph is not a tree.
Since all are false, the answer is E.
A7. [2 marks ] Exactly which of the following statements are true?
(i) There exists a simple graph with 6 vertices and 14 edges.
(ii) There exists a simple 3-regular graph with 9 edges.
(iii) There exists a simple 3-regular graph with 10 edges.
3
A: (i), (iii)
B: (iii)
C: (ii)
D: (i), (ii)
E: None of A, B, C, D
6
2
Solution: (i) true. K6 has
= 15 edges, so the graph obtained by removing a single edge from K6 is a
simple graph with 6 vertices and 14 edges.
(ii) true. K3,3 is a simple 3-regular graph with 6 vertices and 9 edges.
(iii) false. If G were a simple 3-regular graph with n vertices and 10 edges, then by the handshake
lemma, we would have 3n = 20. Since 3 does not divide 20, there is no such graph.
Since (i) and (ii) are true while (iii) is false, the answer is D.
A8. [2 marks ] The number of graphs in a complete collection of complete bipartite graphs on
7 vertices is:
A: 3
B: 4
C: 5
D: 6
E: None of A, B, C, D
Solution: Since two complete bipartite graphs Kr,s , r ≥ s, and Km,n , m ≥ n, are isomorphic if and only
if r = m and s = n, we see that a complete collection of complete bipartite graphs on 7 vertices is given
by { Km,n | m ≥ n, m + n = 7 }. Since we must have m ≤ 7 and n ≥ 1, we have m = 6, n = 7 − 6 = 1,
m = 5, n = 7 − 5 = 2, m = 4, n = 7 − 4 = 3, and that is all.
Thus a complete collection of complete bipartite graphs on 7 vertices has 3 graphs in it. The answer is
A.
•
A9. [2 marks ] The weight of an optimal spanning tree for the
•
graph shown to the right is:
3
3
6 •
1
3
4
5
• 5
3
•
2
•
A: 10
B: 12
C: 13
D: 14
E: None of A, B, C, D
Solution: In preparation for running Kruskal’s algorithm, we construct the sequence of edge weights:
1,2,3,3,3,3,4,5,5,6. Upon running Kruskal’s algorithm, we find that we must take the edge of weight 1, the
edge of weight 2, the edge of weight 3 that joins the upper vertex of degree 4 to a vertex of degree 3 on
the inner 4-cycle, and any two of the remaining three edges of weight 3. At that point, we have selected 5
edges. Since our graph has 6 vertices, we have constructed a minimal spanning tree for the weighted graph
(one such spanning tree is shown below–there are 3 minimal spanning trees, so you might have made a
different choice). All minimal spanning trees have the same weight, so a minimal spanning tree for the
weighted graph has weight 1 + 2 + 3 + 3 + 3 = 12.
•
3
1
•
3
3
•
•
•
2
•
The answer is B.
A10. [2 marks ] If G is a graph with degree sequence (3, 3, 3, 3, 3, 3, 2, 2, 1, 1), how many edges
does G have?
A: 12
B: 24
C: 36
D: 48
E: None of A, B, C, D
Solution: By the handshake lemma, such a graph would have m edges, where 2 m = 3 + 3 + 3 + 3 + 3 +
3 + 2 + 2 + 1 + 1 = 24, so m = 12. Here is a graph with this degree sequence:
•
•
The answer is A.
•
••
••
••
•
A11. [2 marks ] How many vertices does a tree with 25 edges have?
A: 24
B: 25
C: 26
D: 25
E: None of A, B, C, D
2
Solution: A tree on n vertices has n − 1 edges, so n − 1 = 25 means n = 26.
The answer is C.
A12. [2 marks ] The number of graphs in a complete collection of connected simple graphs with
four edges is:
A: 2
B: 3
C: 4
D: 5
E: 6
4
ν Solution: By a result in the text, if G is a connected simple graph, then νG − 1 ≤ εG ≤ 2G , so we
must have νG ≤ 5. If νG ≤ 3, then 4 = εG ≤ 32 = 3, which is not possible. Thus either νG = 5 or else
νG = 4. If νG = 5, then G is connected with εG = νG − 1, so G is a tree. Thus a complete collection of
connected simple graphs with four edges will contain as a subcollection a complete collection of all trees
on 5 vertices. We can construct such a collection by organizing by maximum vertex degree. The possible
maximum vertex degrees for a tree on 5 vertices would be 2, 3, or 4. There is only one tree on 5 vertices
with all vertices of degree either 1 or 2, and that is the chain on 5 vertices. Next, consider the trees on 5
vertices with maximum vertex degree equal to 3. Then there is at least one vertex of degree 3, with the
other 4 of degree at most 3. If there were two vertices of degree 3, then there would have to be exactly
two of degree 1 and then the sum of vertex degrees would be greater than 8. Since 2εG = 8, this would
contradict the handshake lemma. Thus there is exactly one vertex of degree 3, and so there must be an
odd number of vertices of degree 1. Since there are at least two vertices of degree 1 in any tree, we must
have one vertex of degree 3 and 3 vertices of degree 1. The remaining vertex has degree 2. There is only
one (up to isomorphism) to construct such a graph from the star graph on 4 vertices: adjoin a new edge to
one of the degree 1 vertices, termininating in a new vertex. Thus up to isomorphism, there is exactly one
tree on 5 vertices with maximum vertex degree equal to 3. Finally, there is exactly one tree on 5 vertices
with maximum vertex degree 4: the star graph on 5 vertices. Thus there are 3 graphs in a complete
collection of trees on 5 vertices.
Now consider the connected simple graphs with 4 edges on 4 vertices. Those of maximum vertex degree
2 must have all four of degree 2 by the handshake lemma, and up to isomorphism, there is exactly one
such graph, C4 . For maximum degree 3, three of the four edges are incident to one of the vertices, so
the remaining edge must join two of the remaining three vertices. Up to isomorphism, only one graph is
obtained by joining any choice of two vertices of degree 1 in the four vertex star graph.
Thus a complete collection of connected simple graphs with 4 edges contains 3 trees on 5 vertices and
2 graphs on 4 vertices; namely the 4-cycle and the 3-cycle with one new vertex joined by an edge to one
of the vertices of the 3-cycle.
Since a complete collection of connected simple graphs with 4 edges contains 5 graphs, the answer is D.
A13. [2 marks ] What is the maximum number of vertices in a connected simple graph with 30
edges?
A: 15
B: 29
C: 30
D: 31
E: None of A, B, C, D
Solution: There is a result in the text
which states that a simple graph with k components, n vertices and
m edges has n − k ≤ m ≤ n−(k−1)
. Thus for k = 1, we must have n − 1 ≤ 30, and so n ≤ 31. Since a
2
tree on 31 vertices has 30 edges, the maximum number of vertices in a connected simple graph is 31.
The answer is D.
A14. [2 marks ] The maximum possible number of edges for a simple graph with 20 vertices and
two connected components is:
A: 171
B: 190
C: 90
D: 183
E: None of A, B, C, D
Solution: There is a result in the text
which states that a simple graph with k components, n vertices and
m edges has n − k ≤ m ≤ n−(k−1)
. Thus if G is a simple graph with 20 vertices and 2 components, then
2
19
20 − 2 ≤ εG ≤ 20−(1)
;
that
is,
ε
≤
2
2 = (19)(9) = 171.
G
The answer is A.
A15. [2 marks ] If G is a graph with 26 edges and degG (v) ≥ 3 for each vertex v of G, then the
largest possible value for νG is:
A: 18
B: 17
C: 15
D: 13
Solution: By the handshake lemma, we have 3 νG ≤
P
v∈V
G
E: None of A, B, C, D
degG (v) = 2 εG = 52, so it must be that
νG ≤ ⌊ 52/3 ⌋ = 17. Is there actually a graph with 17 vertices and 26 edges? Yes, consider either of
the following graphs. Each has 17 vertices, sixteen of degree 3 and one of degree 4. Thus each has
(3(16) + 4)/2 = 26 edges.
5
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
The answer is B.
•
•
•
•
•
•
•
•
•
A16. [2 marks ] The number of spanning trees for K2,3 is
A: 10
B: 12
C: 32
D: 44
E: None of A, B, C, D
Solution: In the work below, after the first step, the graph obtained by deleting e is a 4-cycle with a fifth
vertex attached by an edge. Since this edge is a cut-edge, the number of spanning trees of the 4-cycle
with this fifth vertex attached is equal to the product of the number of spanning trees of each of the two
components that result when the cut-edge is deleted; that is, of the 4-cycle and the null graph on one
vertex. Then in the last line of the computation, the middle vertex v is a cut-vertex, so the number of
v
v
spanning trees is the product of the number of spanning trees of • • and of • • .
τ
•
• e •
•
•
= τ (C4 ) τ ( • ) + τ
= 2 τ (C4 ) + τ
•
v
•
•
e
•
•
= 2(4) + (2)(2) = 12.
•
•
The answer is B.
A17. [2 marks ] How many cut-edges does the graph
A: 0
B: 1
C: 2
•
•
••
•
•
have?
D: 4
E: None of A, B, C, D
Solution: An edge is a cut-edge if and only if it is not in any cycle. The only such edge is the one whose
two endpoints have degree 3.
The answer is B.
A18. [2 marks ] How many cut-vertices does the graph
A: 0
B: 1
C: 2
•
•
••
•
•
have?
D: 4
E: None of A, B, C, D
Solution: Each of the two vertices of degree 3 are cut-vertices, and none of the vertices of degree 2 are
cut-vertices, so there are two cut-vertices.
The answer is C.
A19. [2 marks ] Exactly which of the following statements are
true for the digraph D shown to the right?
(i) D is simple.
+
(ii) The in-degree, deg D
(b), of b is 1.
−
(iii) The out-degree, deg D (b) of b is 3.
(iv) D is not diconnected.
(v) D is connected (that is, the underlying graph is connected).
a
•
b •
• c
6
A: (i), (iii), (v)
B: (ii), (iii), (iv)
D: (iii), (iv), (v)
E: (ii), (iii), (v)
C: (i), (iv), (v)
Solution: (i) is false. D has no loops, but there are two arcs directed from b to c.
(ii) true. Since b has one inbound incident edge, deg +
(b) = 1.
D
(iii) true. Since b has 3 outbound incident edges, so deg −
(b) = 3.
D
(iv) false. In fact, there is a directed cycle passing through every vertex.
(v) is true.
Since (i) and (iv) are false while (ii), (iii), and (v) are true, the answer is E.
A20. [2 marks ] The maximum number of edges in a simple graph with 14 vertices which contains
no triangles is:
A: 30
B: 36
C: 42
D: 49
E: None of A, B, C, D
2
Solution: By Turan’s theorem, εG ≤ 14 /4 = 49. The answer is D.
A21. [2 marks ] Exactly which of the following are true?
(i) Every non-null tree is bipartite.
(ii) If m ≥ 3, every complete m-partite graph contains a cycle.
(iii) Every bipartite graph contains a cycle.
A: (i)
B: (ii), (iii)
C: (i), (iii)
D: (ii)
E: None of A, B, C, D
Solution:
(i) true. Tree are acyclic, so a non-null tree has no odd cycles, hence is bipartite.
(ii) true. Since there are at least 3 cells, we may choose 3 cells, and select a vertex from each, say v1 ,
v2 , and v3 . Then since the graph is complete multi-partite, the subgraph induced by these 3 vertices is
K3 , a 3-cycle.
(iii) false. For example, K1,1 = K2 is bipartite, but has no cycle.
Since (i) and (ii) are true, while (iii) is false, the answer is E.
A22. [2 marks ] Exactly which of the following graphs are eulerian but not hamiltonian?
•
•
•
(i)
A: (i)
•
•
•
•
•
•
B: (iii)
•
•
•
•
•
•
•
•
•
•
(ii)
C: (ii), (iii)
•
•
(iii)
•
•
•
(iv)
D: (i), (ii), (iii)
E: None of A, B, C, D
Solution: A connected graph is eulerian if and only if every vertex has even degree. Thus graphs (i),
(ii) and (iii) are eulerian, while graph (iv) is not. Of the first three graphs, (i) has a cut-vertex and is
therefore not hamiltonian, while (ii) is obviously hamiltonian. (iii) is also hamiltonian as may be seen by
alternating between vertices on the outer triangle and vertices on the inner 3-star. Thus only graph (i) is
eulerian and not hamiltonian. The answer is A.
A23. [2 marks ] For the RSA public key encryption algorithm with the primes p = 13 and
q = 17, d = 11 is a valid decryption key for the encryption key e = 35. Given that M is a
message with (M e )d ≡ 342 (mod pq), what is M?
A: 21
B: 120
C: 121
D: 18
E: 11
e d
Solution: We know that 0 < M < pq and M ≡ (M ) (mod pq). Since pq = 221, we have M ≡
342 (mod 221), so M = 342 − 221 = 121.
The answer is C.
PART B
B1. [3 marks ] Given the following data p = 7, q = 13, so that pq = 91 for a RSA encryptiondecryption algorithm, verify that d = 5 is the private key for the public key 29.
7
Solution: We have e = 29 and n = 91 = (7)(13), so ϕ(n) = ϕ(91) = (6)(12) = 72. We must verify that
ed ≡ 1 (mod ϕ(n)), or 29(5) ≡ 1 (mod 72). Since 29(5) = 150 − 5 = 145 ≡ 145 − 2(72) = 1 (mod 72), it
is true that d = 5 is the private key for the public key 29.
B2. [3 marks ] What is the maximum number of edges that a simple connected graph G on 17
vertices can have such that there is no subgraph isomorphic to K7 ?
Solution: By Turan’s extremal theorem, each simple graph G on n vertices which contains no subgraph
isomorphic to Km can have at most the floor of (m − 2)n2 /(2m − 2) edges. So G can have at most 120
edges.
B3. [3 marks ] There are six graphs in a complete collection of trees on six vertices. Draw
them all.
Solution:
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
B4. (a) [2 marks ] Draw the join of the null graph on two vertices and the chain graph on
three vertices.
Solution:
•
•
•
•
•
(b) [2 marks ] Give the degree sequence of the join of the null graph on two vertices and
the chain graph on three vertices.
Solution: The graph is shown in the solution to part (a). There is one vertex of degree 4 and four
vertices of degree 3, so the degree sequence is (4, 3, 3, 3, 3).
B5. [2 marks ] For positive integers m and n, Km,n is a simple graph on m + n vertices. How
many edges must be added to Km,n in order to obtain
Km+n ? Explain your answer.
Solution: Since Km,n has mn edges and Km+n has m+n
edges, the number of edges that we must add
2
is m+n
−
mn.
We
may
also
represent
this
value
as
2
m+n
(m + n)(m + n − 1)
− mn
− mn =
2
2
(m + n)(m + n − 1) − 2mn
m2 + n 2 − m − n
=
=
2
2
m(m − 1) n(n − 1)
m
n
=
+
=
+
.
2
2
2
2
B6. Consider the weighted graph G given by:
•
2
3
2
2
•
•
2
1
•
2
•
3
(a) [2 marks ] Illustrate the use of Kruskal’s algorithm by sketching a sequence of spanning
subgraphs of G that the algorithm constructs on its way to producing an optimal
spanning tree for G.
Solution:
•
•
2
2
2
•
•
1
•
•
2
1
•
•
•
2
•
At the first stage, we choose the single edge of least weight. At the second stage, we must choose the
edge of weight 2 to the lower right, and we see that we may choose either of the two edges shown as
dashed, and either of the two edges shown as dotted. In any event, as soon as we make our choices,
we will have chosen in total 4 edges, so the result will be an optimal spanning tree for G.
8
(b) [2 marks ] How many optimal spanning trees does G have? Draw them all.
Solution:
•
•
•
2
•
2
2
2
2
•
•
2
1
•
•
2
1
2
•
•
1
2
•
2
•
•
•
1
2
•
•
•
•
2
•
•
(c) [3 marks ] Calculate τ (G), the number of spanning trees of G (considered as an unweighted graph).
Solution:
•
τ (G) = τ
•
•
•
e
•
•
=τ
•
•
= 2 τ (K4 ) + τ
= 2 τ (K4 ) + τ [•
•
•
•
h
+τ
•
•
•
•
e
i
•] + τ •
•
a
•b
= 2(42 ) + 4 + 4 = 40.
B7. Consider the graph G shown below.
•
•
•
h•
•c
g•
•
d
f
•
•
e
(a) [2 marks ] List the vertices of G whose distance from a is odd.
Solution: The vertices b, d, and h are a distance 1 from a, while the vertices c, e, and g are a distance
2 from a, and f is a distance 3 from a. Thus the vertices which are an odd distance from a are b, d,
h, and f .
(b) [2 marks ] Is G bipartite? Provide reasons for your answer.
Solution: G contains a cycle of length 5. Since a bipartite graph does not contain any cycles of odd
length, it follows that G is not bipartite.
B8. (a) [2 marks ] Prove that a simple connected graph G with 14 vertices and 82 edges is
hamiltonian. Establish your answer.
Solution: We know that a simple graph with at least three vertices and has at least
is hamiltonian, and 14−1
+ 2 = 78 + 2 = 80 < 82, thus G is hamiltonian.
2
n−1
2
+ 2 edges
(b) [3 marks ] Prove that G is not bipartite.
Solution: Since each simple graph on n vertices which is without 3-cycles has at most the floor of
n2 /4 and G has 82 > 142 /4 = 49, then at least one 3-cycle exists so G is not bi-partite.
B9. [3 marks ] Prove that if G is a connected graph such that every vertex has degree at least
2, then G contains a cycle.
Solution: G is a connected graph with no vertices of degree 1. Since a tree contains at least two vertices
of degree 1, G is not a tree. Since a connected acyclic graph is a tree, and G is connected, it must be that
G is not acyclic; that is, G contains a cycle.
9
Bonus: [3 marks ] Construct the spanning tree T of K6 that corresponds to the sequence S =
(1, 2, 3, 4), using the inverse of the Prüfer correspondence.
Solution: Will be shown in class.
© Copyright 2026 Paperzz