0% found this document useful (0 votes)
137 views4 pages

MATH1179 Graph Theory Book Solution

The document provides examples and solutions to graph theory problems involving graphs, trees, and binary search trees. It includes problems such as drawing graphs from descriptions of vertices and edges, finding walks and cycles in graphs, determining minimum spanning trees, and evaluating binary expressions using binary trees. Solutions are provided for adjacency matrices, identifying spanning trees, calculating walk lengths, and building binary search trees from lists of words and numbers.

Uploaded by

Oviyan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
137 views4 pages

MATH1179 Graph Theory Book Solution

The document provides examples and solutions to graph theory problems involving graphs, trees, and binary search trees. It includes problems such as drawing graphs from descriptions of vertices and edges, finding walks and cycles in graphs, determining minimum spanning trees, and evaluating binary expressions using binary trees. Solutions are provided for adjacency matrices, identifying spanning trees, calculating walk lengths, and building binary search trees from lists of words and numbers.

Uploaded by

Oviyan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

MATH1179 Mathematics for Computer Science

Graph Theory Tutorial - solutions


1. Draw the graph with vertices, a, b, c, d, e, f and edges
(a,b), (a,e), (a,f), (b,c), (b,f), (c,e), (d,e), (e,f)
Find one walk of length 2 and two walks of length 3 from vertex a to vertex e.
Are any of these paths? Find a cycle in the graph.

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)

4. Find two spanning trees for the graph in question 1.

b b c
c

a a

d d

e e

f f

5. Write down the adjacency matrix for the graph in question 1.

Graph Theory Page 1


MATH1179 Mathematics for Computer Science

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 
  

0 walks length 2, 3 walks length 3 v1v2v1v3, v1v3v4v3, v1v3v1v3


v3 v4
7. Find a minimum spanning tree for the graph shown.
b

9 4

a c
11

8 7 2
3

f 5 e d
4

Minimum spanning tree has total weight of 22 edge weight accept


cd 2 Y
b
ce 3 Y
bc 4 Y
de 4 N
a
c ef 5 Y
be 7 N
af 8 Y
f
e ab 9 N
d ac 11 N

Graph Theory Page 2


MATH1179 Mathematics for Computer Science

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

binary for tree


in
the words
this
sentence

Graph Theory Page 3


MATH1179 Mathematics for Computer Science

11. Using a binary tree evaluate the expression (a→¬b) ∨ ((¬c→a)∧b) when a and b are true and
c is false.
true

Graph Theory Page 4

You might also like