MATH1179 Graph Theory Book Solution
MATH1179 Graph Theory Book Solution
b c
walk length 2 = afe
a walk length 3 = afae,aede,aeae,abae,aece,aefe
path length 3 = abfe,abce
d
cycle = abfa (or other)
e
f
2. Draw a graph which has 6 vertices, is not connected and which has a cycle of length 4.
Or other ...
3. Draw all trees which have 4 vertices. Draw all trees which have 5 vertices. (no isomorphisms)
b b c
c
a a
d d
e e
f f
0 1 0 0
1 1
1 0 1 1
0 0
0 1 0 0
0 1
0 0 0 0
0 1
1 0 1 1
1 0
1 1 0 0 1 0
6. A graph G with vertices v1, v2, v3 and v4 has adjacency matrix A A =
0 1 1 0
1 0 0 0
1 0 0 1
0 0 1 0
Draw the graph of G.
Find the number of walks of length 2 and 3 between vertices v1 and v3
Identify these walks.
0 1 1 0 2 0 0 1 0 2 3 0 v1 v2
1 0 0 0 0 1 1 0 2 0 0 1
A= AxA AxAxA
1 0 0 1 0 1 2 0 3 0 0 2
0 0 1 0 1 0 0 1 0 1 2 0
9 4
a c
11
8 7 2
3
f 5 e d
4
8. Five computers A, B, C, D and E are to be connected. The cost of the possible connections are
A B C D E
A 52 37 16
B 23 12 15
C 10
D 12
Draw this as a graph and using Kruskal's algorithm find a minimum spanning tree for the
graph.
Hence find the minimum cost of connecting the computers.
If computer A must be connected to computer B, what difference does this make to your answer
?
Minimum cost goes up from 50 to 86 edge weight accept
AB 52 Y
A B A B CE 10 Y
BD 12 Y
DE 12 Y
C C
BE 15 N
edge weight accept
AD 16 N
CE 10 Y
BC 23 N
BD 12 Y
AC 37 N
DE 12 Y
BE 15 N E D E
D
AD 16 Y
BC 23 N
AC 37 N
AB 52 N
9. Put the numbers 23, 43, 15, 37, 25, 46, 67, 12, 18 in a binary search tree with 23 as the root.
23
15 43
37
12 18
46
25
67
10. Find a binary search tree for the words in this sentence. Use 'find' as the root.
find
a search
11. Using a binary tree evaluate the expression (a→¬b) ∨ ((¬c→a)∧b) when a and b are true and
c is false.
true