CSCI 190 Exam III Practice solutions

CSCI 190 Exam III Practice
1) (6 points) Prove that a connected simple graph of order greater than one with no circuits
has at least one vertex of degree 1.
Pf: Let
v1 , v2 ,
vk be a longest path in the graph. We claim that the degree of v1 (and vk ) is one.
Since the graph is connected and the order of the graph is more than one, the degree of
greater than or equal to one. If the degree of
edge from
v1 must be
v1 must be greater than one, then there must be an
v1 to a vertex other than v2 . If this edge connects v1 with v3 , v4 ,
vk , then this would
create a circuit. Since we are assuming there are no circuits, there must be an edge from
vertex that is not in
longer than
v1 , v2 ,
{v3 , v4 ,
vk } , say v0 . But this would mean v0, v1 , v2 ,
vk , which contradicts the assumption that v1 , v2 ,
graph. Therefore the degree of
v1 to a
vk is a path in the graph
vk is a longest path in the
v1 is one.
2) ( 6 points) 30 of the 50 US state flags have blue as a background color, 12 have stripes, 26
exhibit a plant or animal, 9 have both blue in the background and stripes, 23 have both blue
in the background and feature a plant or animal, and three have both stripes and a plant or
animal. . Two state flags have blue in the background, stripes, and plant or animal. How
many state flags have no blue in the background, no stripes, and no plant or animal
featured?
Solution:
Let A= state flags that have blue as a background color
B= state flags that have strips
C= state flags that exhibit a plant or animal.
We are looking for ( A  B  C )
c
( A  B  C )c  50  ( A  B  C)  50  ( A  B  C  A  B  A  C  B  C  A  B  C )
 50  (30  12  26  9  23  3  2)  15
3) (4points each) Determine if each of the following degree sequences on 6 vertices are
possible. Sketch a graph with the given degree sequence if possible. If not possible,
explain briefly why not. Justify your answer.
a) 1, 2, 3, 4, 5, 5
Solution: this is impossible.
Since there are 6 vertices, the two vertices of degree 5 must be
connected to every vertex. Thus a vertex of degree one is impossible.
b) 3,3,3,2,2,2
Solution: this is impossible. By the handshaking theorem, the number of vertices of odd degrees
must be even.
4) ( 4 points each) Use the following adjacency matrix for the following questions
0 0 0 
1 0 1 


1 1 0 
a) Construct a graph for the following adjacency matrix.
Solution: Since the matrix is not symmetric, its graph must be directed,
b) Find the number of paths from
v1 to v3 that uses exactly 4 edges. You must apply theorem
discussed in class. DO NOT use a brute force approach.
0 0 0 

 4
Solution: Compute ( 1 0 1 ) (the fourth power of the matrix).


1 1 0 
Then (1,3) entry of the matrix is the number of paths from
v1 to v3 that uses exactly 4 edges.
0 0 0 
0 0 0
0 0 0   0 0 0 
( 1 0 1  ) 2  1 0 1   1 0 1    1 1 0 
1 0 1`
1 1 0 
1 1 0 1 1 0 
2
0 0 0 
0 0 0
0 0 0 




4
( 1 0 1  )   1 1 0    * * *  (* indicates the entry is insignificant)
1 0 1`
1 1 0 
* * *`
Since the (1,3) entry is 0, there are no paths from
v1 to v3 that uses exactly 4 edges.
5) Define a relation on {1, 2,3, 4,5, 6, 7,8} as follows:
aRb iff a b .
You may assume R is a partial
ordering.
a) (4 points) Construct a Hasse diagram for the relation.
b) “””{
c) (2 points) Is R a linear ordering? Justify your answer.
Solution: No, (3,5) is not in the relation
d) (2 points) Is R a lattice? Justify your answer.
Solution: No. 5 and 7 do not have the least upper bound.
6) (4 points each )Use the graph below to answer the questions:
a) Is the graph bipartite?
Solution: A graph bipartite iff it Is 2-colorable: i.e. using two colors adjacent vertices
receive different colors. Use black (B) and Green (G) to color the vertices.
V1  G, V5  R, V6  G,V2  R, V7  R, V3  G, V9  G,V4  G,V8  G,V10  G
b) Find
 (G )
Solution:
and minimal cut edge set.
 (G )  1 Removing any edge would increase the number of connected
components.
c) Find
 (G )
Solution:
and minimal cut vertex set.
 (G )  1 and {V5},{V6},{V7} are minimal cut vertex sets.
7) Let G=(V,E) be a undirected graph, where V is the vertex set of G and E is the edge set of G.
Define a relation on V as follows: aRb iff a=b or there is a path from a to b.
a) (6 points) Show R is an equivalence relation.
Solution:
i)
ii)
iii)
aRa for all a in V since a=a.
Symmetry: Suppose aRb . Case 1) If a  b then b  a . Thus bRa
Case 2) If a  b , there is a path from a to b. Since the graph is undirected, this is
a path from b to a. Therefore bRa
Transitivity: Suppose aRb and bRc . Case 1) If a  b and b  c , then a  c .
Therefore aRc
Case 2) If a  b and b  c , then there is a path from b to c. Since a=b, this is a
path from a to c. Therefore aRc
Case 3) ) If a  b and b  c , then there is a path from a to b. Since b=c, this is a
path from a to c. Therefore aRc
Case 4) if a  b and b  c , then there is a path from a to b and a path from b to c.
Combining the paths would give a path from a to c. Therefore aRc
b) (2 points) Describe the equivalence classes using a terminology from graph theory.
Solution: the equivalence classes are the connected components of the graph.
8) (4 points) Construct all non-isomorphic undirected graphs of order 4.
There are 11.
A)
B)
C)
D)
E)
F)
G)
H)
I)
J)
K)
9) (2 points each) Do not show work.
a) Name three invariants of an isomorphism of graphs.___________,____________,__________
Solution: degree sequence, the number of vertices, the number of edges
b) For
Solution:
R1  {(1, 2),(1,3),(2,3)}, R2  {(1, 2),(3,1),(2, 2)} , find R1 R2 _________________________
R1 R2  {(1,3),(3, 2),(2,3)}
c) Define a relation on the set of real numbers that is both an equivalence relation and a
partial ordering._____________________________
Solution: define a relation R on the set of real numbers as follows:
aRb iff a  b
d) (True/false) The greatest element may not be a maximal element.
Solution: this is false. The greatest element dominate all elements, so it cannot be
dominated by any element. So the greatest is a maximal.
e) Arrange (1,100), (2,-1), (-1,23) in increasing order using Lexicographic ordering on
R2
Solution: (-1,23),(1,100),(2,-1)
10) (4 points) Determine whether the following graphs are isomorphic. Justify your answer.\
Solution: they are not isomorphic. There are two vertices of degree 4 in G1 (b and d), but only one
vertex is of degree 4 in G2.
11) (4 points) Find an Euler circuit if possible.
12)
Define a relation R in on the set of ordered pairs
R 2 as follows:
(a, b) R(c, d ) iff a 2  d 2  b 2  c 2
a) Is R reflexive?
Solution: Yes,
(a, b) R(a, b) since a 2  b 2  b 2  a 2
b) Is R symmetric?
Solution: Yes. If
expressed as
(a, b) R(c, d ) a 2  d 2  b 2  c 2 . Then (c, d ) R(a, b) since a 2  d 2  b 2  c 2 ca be
c2  b2  d 2  a 2
c) Is R antisymmetric?
Solution: No:
(1,1) R(2, 2) since 12  22  12  22 and (2, 2) R(1,1) since 22  12  22  12 . But (1,1)  (2, 2)
d) Is R transitive?
Solution: yes. If
(a, b) R(c, d ) and (c, d ) R(e, f ) , then (a 2  d 2  b2  c 2 )  (c 2  f 2  d 2  e2 )
Adding these equations, we get
a 2  f 2  b2  e2 .
Therefore
a 2  d 2  c 2  f 2  b2  c 2  d 2  e2 , which simplifies as
(a, b) R(e, f )
2
[(1,3)]=
{(a, b) : (a, b) R(1,3)} that is,
2
 b   a 
{(a, b) : a  3  b  1}  {(a, b) : 
 
  1} .
 2  2
2
2
2
This is a
hyperbola crossing the y-axis.
e)
13) Let G be a simple graph with n vertices for some even number n. Show that if the
minimum degree of the vertices is greater than or equal to
n 1
, then the graph is
2
connected.
Pf: Use contradiction. Suppose the graph is not connected. Then there are at least two connected
n
vertices. Then all the vertices in the
2
n
n 1
 1 , which is less than
smaller components are a most of degree
. Therefore, there is a
2
2
n 1
vertex of degree less than
.
2
components. Then one of the components has at most
14) Suppose an unlimited number of doughnuts is available in each of three different types. Use
a generating function to find the number of ways to select 10 doughnuts if we must select
at least two doughnuts of each type. You may use the formula
Solution: Let
( x 2  x3  x 4 
1 n   n  k  1 k
(
)  
x
1 x
k 
k 0 
an be the number of ways to select n doughnuts. Then its generating function is
)3  ( x 2 (1  x  x 2 
))3  x 6 (


 3  k  1 k
 k  2  k   k  2  k 6
1 3
6
)  x6  
x

x


 x  
x

1 x
k 
k 
k 
k 0 
k 0 
k 0 
The coefficient of x is given when k=4. Therefore, there are
10
 4  2

  15 ways.
 4 
15) Show that a full binary tree having exactly k internal vertices has exactly k+1 leaves.
Pf: a full binary tree having exactly k internal vertices has exactly 2k+1 vertices. A vertex
can be either a leaf or an internal vertex. Since there are k internal vertices, the remaining
(2k+1)=k=k+1 vertices are leaves.
16) Define a relation on the set of real numbers as follows:
aRb iff a  b  0 Determine if the relation is
a. Reflexive
Solution: no,
2R  2 since 2  (2)  0
b. Symmetry
Solution: yes, if
aRb , then bRa since a  b  b  a
c. Transitive
Solution: no.
2R5 and 5R(1) , but 2 R (1)
d. Antisymmetric
Solution: no,
2R3 and 3R2 but 2  3
e. Irreflexive
Solution: no.
2R2
17)
A relations the positive real numbers is defined as follows:
R1  {(a, b) : a  b} , R2  {(a, b) : a b}
a) Find
R1  R2
Solution: observe that R1
b)
describe R1
 R2 since if a b , then a  b . Thus R1  R2  R1
2
Solution: R1  {(a, c) : b s.t. ( a, b)  R1  (b, c)  R1} : i.e. R1  {(a, c) : b s.t. a  b  b  c} . But
2
this is just
2
R1 since b s.t. a  b  b  c iff a  c
18) Define a relation R on the set of rational numbers as follows: )
aRb iff a  b is an integer.
a) Show R is an equivalence relation.
Solution:
aRa since a  a  0 is an integer.
2) Symmetric: if aRb , then a  b is an integer. Then b  a  (a  b) is also an integer.
Thus bRa .
3) Transitive: If aRb and bRc , then a  b and b  c are both integers. Then their sum
(a  b)  (b  c)  a  c is also an integer. Thus aRc
1
b) Find three elements in [ ]
2
1
1
1 3 5
1
 b is an integer. [ ] contains , , . [ ] is the
Solution: Find three numbers such that
2
2
2 2 2
2
1) Reflexive:
set of fractions with denominator 2.
19) Find all the connected components(2 points) and cut vertices(2 points) and
 (G )
(1 point)
for the graph shown below:
a.
b.
.f
c.
.d
.e
.g
20) (1 points) Is the graph shown below a tree? Justify your answer.
21) (4 points)
Find all nonisomorphic rooted trees with 4 vertices.
22) (5 points each)
a) Let R be a relation on a nonempty set A. Show that if R is transitive, then
R2  R
(a, b)  R 2 . We need to show (a, b)  R . By definition of composition, (a, b)  R 2  c in A
with ( a, c)  R and (c, b)  R . Since R is transitive, ( a, b)  R .
Solution:
b) Let R be a reflexive relation on a nonempty set A. Show that
Solution: let
Since
R  R2
(a, b)  R . We need to show (a, b)  R 2 . Since R is reflexive, (a, a)  R .
(a, a)  R , (a, b)  R (a, b)  R 2 . (i.e. if you can get from a to b in one step, then
you can get from a to b in 2 steps: first from a to a, then from a to b.
23) .
a) ( 5points) Let G be a simple graph. Define a relation on the set of vertices of G as
follows: (u , v)  R iff there is an edge connecting u and v. a) Is R reflective? b) Is R
transitive? Justify your answer.
a) No. (u , u )  R means there is a loop at u. But this is impossible since the graph is
Pf:
simple. B) If
(u , v)  R and (v, w)  R there is a path from u to v and there is a path from v to
w. Therefore
(u , w)  R since u, v, w is a path.
24) Is (3,3,2,1,1) a degree sequence of a simple (undirected) graph? Justify your answer.
Yes. For example, the following graph has the degree sequence.
25) Define
ak to be the number of ways to make k cents in change using nickels and quarters
only. Construct a generating function for
ak .
You must simplify the geometric series.
Solution:
(1  x5  x10  x15  )(1  x 25  x50  x 75  )  (
1
1
)(
)
5
1  x 1  x 25
1 1 1


26) Consider a relation R represented by the matrix 0 1 1


0 1 1
a) Is R reflective?
Solution: yes.
(v1 , v1 )  R, (v2 , v2 )  R, (v3 , v3 )  R since the diagonal elements are 1.
b) Is R symmetric?
Solution: No.
(v1 , v2 )  R,(v2 , v1 ) 
 R,
c) Is R antisymmetric?
No.
(v2 , v3 )  R,(v3 , v2 )  R, but v2  v3
d) Is R transitive? Justify your answer.
27)
e) Can R be the adjacency matrix of a simple graph? Justify your answer.
Consider a Hasse diagram shown below:
b)
Find all the maximal elements.
Solution: 30 is the only maximal element.
c) Find all the upper bounds of {3,6}
Solution: 6 and 30
d) Is this a lattice?
Yes, every pair has LUB and GLB
28) Let G=(V,E) be a simple graph. Show that if  (G )  2 , then G contains a path of length at least
two.
Pf: First observe that the graph must have at least three vertices. If there are only two
vertices, then
 (G )  1 since its graph is just an edge connecting those two vertices. Pick
any vertex in G and label it
another vertex, label it
other than
v1 . Since deg v1 is more than one, there is an edge from v1 to
v2 . Since deg v2  2 , there is an edge connecting v2 to a vertex
v1 , label it v3 . Then v1  v2  v3 is a path of length 2.
29) Consider a relation
R  {( 3,4), (4,3), (2,3), (1,1), (2,2)} on {1,2,3,4}
a) R is not symmetric. Add the smallest number of elements to R to make the
relation symmetric.
Solution:
R  {(3, 2)} is symmetric.
a) R is not transitive. Add the minimum number of elements to R necessary to make
the relation transitive. (use the original relation, not the relation constructed in a))
Solution:
R  {(3,3), (4, 4), (2, 4)} is transitive
b) Is R antisymmetric? Justify your answer.
Solution: No,
(3, 4)  R, (4,3)  R but 3  4
30) Define relations on the set of the natural numbers as follows:
R1  {( a, b) : a b} ,
R2  {( a, b) : a  b} , R3  {( a, b) : a  b} , R4  {( a, b) : a  b}
a) Find R1
Solution:
2
R12  {(a, c) : b with a b  b c} .
a) Find
Solution: This is
{(a, c) : a c} , which is just R1 .s
R3  R4
Solution: This is
b) Find
But this is same as saying
R3 . R3 does not contain any elements in R4 .
R2  R3
R2 since R3 is a subset of R2 .
31)
c) Let R be a relation on a nonempty set A. Show that if R is transitive, then
Pf:
R2  R
(a, b)  R 2 . Show (a, b)  R . (a, b)  R2  c in A such that (a, c)  R  (b, c)  R .
Since R is transitive, ( a, b)  R .
Let
d) Let R be a transitive and reflexive relation on a nonempty set A. Show that
Pf: Let ( a, b)  R . Show
transitivity,
R  R2
(a, b)  R 2 . Since R is reflexive, Let (a, a)  R . Using
(a, a)  R  (a, b)  R  (a, b)  R 2 .
(a, b)  R 2 but (a, b) 
 R
2
Let A  {1, 2,3}, R  {(1, 2), (2,3)} . (1,3)  R but (1,3) 
 R
e) Find an example of a relation on A such that
32) Proof: Suppose ( a, b)  R and (b, a )  R . Then since R is transitive, (a, a )  R , which is
impossible since R is irreflexive. Thus if ( a, b)  R , then (b, a ) 
 R . Therefore R is
antisymmetric.