0% found this document useful (0 votes)
5 views8 pages

02 Graphs

The document discusses graph theory, focusing on the definition and properties of graphs, including vertices, edges, loops, and degrees. It explains different types of graphs such as simple, connected, complete, and bipartite graphs, along with concepts like trees and incidence matrices. Additionally, it includes practice questions to reinforce understanding of graph theory concepts and applications.

Uploaded by

Fatima Muhaimin
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)
5 views8 pages

02 Graphs

The document discusses graph theory, focusing on the definition and properties of graphs, including vertices, edges, loops, and degrees. It explains different types of graphs such as simple, connected, complete, and bipartite graphs, along with concepts like trees and incidence matrices. Additionally, it includes practice questions to reinforce understanding of graph theory concepts and applications.

Uploaded by

Fatima Muhaimin
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/ 8

Modelling

With
Algorithms
2. Graphs
The graphs you are used to plotting on the (x,y) plane have an infinite set of possible points on the plane
and an infinite number of points on any curve or line you draw. These are continuous graphs. In many
situations you have to deal with discrete sets of data with a finite set of points so continuous graphs are
not appropriate. Graphs drawn for discrete data look different but they are called graphs as they
represent sets of points and the relationships between them. Graph theory was first explored hundreds of
years ago but was thought of as little more than a game for mathematicians and was not taken seriously
until the late twentieth century. The growth in computer power led to the realisation that graph theory
can be applied to a wide range of industrial and commercial management problems of considerable
economic importance.
This chapter introduces the language used in graph theory and how to model and solve real life problems.

The language of graphs


A graph consists of a finite set of points An edge joins one vertex to another
(vertices or nodes) connected by lines (edges or arcs).

A loop is where an edge starts If you have more than one edge joining the same
and ends at the same vertex pair of vertices, these are called multiple edges

Graphs can be used to represent road, train or tube maps. They represent real geographical networks.
Other everyday situations might be represented.

A road system Friendships among a group of students

• Most edges are drawn as straight lines (this is only for convenience). The important thing is which
vertices are joined.
• Each edge joins only two vertices. e.g. ABC is two edges AB and BC.
• Crossings of lines are not vertices unless defined as such. Edges may be shown crossing.

1
A simple graph is one in which there are no loops and no multiple edges.

The friendships graph, on the last page, is disconnected as it falls apart into two separate pieces.
A connected graph is one where every vertex is linked by a single edge or sequence of edges to every
other vertex. A simply connected graph linked satisfies both definitions.

A complete graph is a simple graph in which every vertex is connected to every other by a single edge.
A complete graph with n vertices is denoted by Kn.

The degree of a vertex is the number of edges which start or finish at it.
A loop counts twice towards the degree of the vertex, because you can go either way round it.
Vertex Degree
A 3
B 4
C 4
D 4
E 3

If you find the sum of the degrees of the vertices in the graph (18) and compare it with the number of
edges you will notice that the sum of the degrees of the vertices is twice the number of edges.

This is known as the Handshaking theorem and can be written as ∑degrees of vertices = 2 x edges

It is easy to prove. The degree of each vertex is the number of edge ends at that vertex and since each
edge has two ends, the number of edge ends must be twice the number of edges.

If the edges of a graph have a direction associated with them they are known as directed edges and the
graph is known as a digraph. Note that the degree of a vertex is only defined for a graph, not for a
digraph.

a digraph the same digraph shown differently

A subgraph is part of a graph which is itself a graph. A graph can have several subgraphs, not all of
which are connected. For example these are all subgraphs of K 5.

2
Practice Questions 1 - The Language of Graphs

1. For each of the graphs a) to f), write down


(i) The number of vertices
(ii) The number of edges
(iii) The degree of each vertex.

2. Say which of the graphs, if any,


in Question 1 are
(i) simple
(ii) connected and/or
(iii) complete

3. Draw graphs to fit the following descriptions:

(a) The vertices are A,B, C and D; the edges join AB, BC, CD, AD and BD.

(b) The vertices are P, Q, R, S and T, and there are edges joining PQ, PR, PS and PT.

(c) The graph has vertices W, X, Y and Z and edges XY, YZ, YZ, ZX and XX.

(d) The graph has five vertices, each joined by a single edge to every other vertex.

(e) The graph is a simple connected graph with four vertices and three edges.

4. Draw all simple graphs with four vertices (A, B, C, D) and two edges, one of which is AB.

5. Indicate which of the following are possible, drawing any that are:
(a) A graph with four vertices of degrees 1,1,2 and 3
(b) A graph with four vertices of degrees 1,1,3 and 3
(c) A simple graph with four vertices of degrees 1,1, 3 and 3

6. The plan of the ground floor of a house is shown below:

Draw a graph in which the vertices represent rooms, and in which two vertices are connected
by an edge, if there is a connecting door between the rooms.

Watch – FMSP video 1.1 ‘Intro to Graphs’ on our site.


– Complete ‘MEI MWA Graphs – Working with Graphs - Exercise level 1’ from our site.
3
Planarity
A famous problem is to connect each of three houses to all three services, electricity, gas and water with
no pipe or cable crossing another.
Four of the nine lines needed have already been put into the picture.
See if you can draw in the other five.

A planar graph is one which can be drawn without any edges crossing. This is particularly useful in the
design of microelectronic circuits on silicon chips. It is better to send the connection a long detour round
the edge than to construct a bridge as bridges are unreliable.
It is not always immediately obvious if a graph is planar so it may be necessary to redraw it as a check.

Bipartite Graphs

A bipartite graph is where there are two discrete sets of vertices with edges only joining vertices
between sets and not within a set.

Example:
A party has been arranged and the guests have been asked to state their dietary restrictions.
Here are some of the replies:
Joan won’t eat meat. John eats only white meat and potato products.
Jane eats anything. Jack doesn’t eat pasta.
The dishes will include: beef sandwiches, green salad, pasta salad, potato crisps, chicken drumsticks

Draw two bipartite graphs to represent (a) what the guests will eat and (b) what the guests won’t eat

A complete bipartite graph is one in which each vertex in A is joined to every vertex in B by an edge, it
is denoted a Kr,s which would have a set of ‘r’ vertices joined to a set of ‘s’ vertices.

Isomorphic Graphs
Two graphs are said to be isomorphic if they have the same structure. That means they must have the
same number of vertices and edges, furthermore the vertices must have the same degrees as well. In a
sense one graph may be stretched or twisted to form the other and the two graphs would be represented
by the same incidence matrices.
4
Practice Questions 2 – Bipartitie Graphs

1. Two opposing teams of chess players meet up to play for some matches.
Show how a bipartite graph can be used to represent the games actually played. State how many players
you have shown in each team and the total number of matches played.

2.(a) Airports have direct flights leaving to the following destinations.

Heathrow Bristol, Birmingham, E. Midlands, Manchester, Newcastle


Gatwick E. Midlands, Manchester, Newcastle
Stanstead Bristol, Manchester, Newcastle
Luton Bristol, Birmingham, Manchester, Newcastle

Draw a bipartite graph to represent the flights information:

(b) If in addition to the above flights a helicopter connection is introduced linking Heathrow and Gatwick,
will it then be possible to represent direct flights by a bipartite graph?

3. Small washers, sizes 4 and smaller, can be used with bolts of the same size or of one size smaller.
Larger washers, sizes 5 and above, can be used with bolts of the same size, of one size smaller, or of two
sizes smaller.
Draw a bipartite graph to show with which sizes of bolts from 2 to 8, washers of sizes 2 to 8 can be used.

4. Do the following matrices represent bipartite graphs?


a) b)
A B C D E A B C D
A - 1 - - - A - - 1 1
B 1 - 1 1 - B - - - 1
C - 1 - - 1 C 1 - - 1
D - 1 - - 1 D 1 1 1 -
E - - 1 1 -

(c) Vertex set = (A, B, C, D, E) and Edge set = ((A,B), (B,D), (A,C), (C,E))

Trees
A connected graph in which there are no cycles is called a tree.

Look at the graphs below and decide which of them are trees

Count the vertices and edges of the graphs you have identified as trees. You will see that the number of
edges of a tree is always one less than the number of vertices.
This is obvious when you think about it: if the tree is built up one vertex at a time, starting with one
vertex and no edges, each new vertex needs exactly one edge to join it to the body of the tree.

5
A spanning tree is a subgraph which includes all the vertices in the original graph and is also a tree. A
graph will have several trees.

These are spanning trees of the network ABCDEF. There are others. As with all trees, for a network of n
vertices there will be n-1 edges in the spanning tree.

Incidence Matrices
Graphs are useful for picturing relationships between objects but they can also be represented by
matrices. This allows the information stored in the graph to be manipulated by a computer. Some graph
problems can be solved much more quickly by running an algorithm on a computer.

For example, this graph can be represented by this matrix

To
A B C D
A 0 1 0 1
From B 1 0 1 0
C 0 1 0 1
D 1 0 1 0

The vertex set is  A, B, C, D  and the edge set is {AB, BC, CD, DA}

and this graph can be represented by this matrix

To
A B C D
A 2 1 0 1
From B 1 0 0 0
C 0 0 0 1
D 1 0 1 0

Both of the above matrices have symmetry about the leading


diagonal, this is because there are no directed edges in the graph.

6
Practice Questions 3 – Incidence Matrices

1. Produce matrices to represent the following graphs and digraphs

2. Draw a pictorial representation of the following graph.

A B C D E
A 1 1 1 0 1
B 1 0 1 1 1
C 1 1 0 0 1
D 0 1 0 1 0
E 1 1 1 0 1

3. Produce a matrix to represent the following digraph, and draw a picture of it:

Vertex set = {V W X Y Z}

Edge set =

4. The matrix below represents a bipartite graph. Draw the graph.

A B C D E F G H I J K
A - 1 - - 1 - - - - - 1
B 1 - 1 - - - 1 - - - -
C - 1 - 1 - - - - - - -
D - - 1 - - - - - - - -
E 1 - - - - - 1 - - - -
F - - - - - - - 1 1 - 1
G - 1 - - 1 - - 1 - - 1
H - - - - - 1 1 - - - -
I - - - - - 1 - - - 1 -
J - - - - - - - - 1 - -
K 1 - - - - 1 1 - - - -

Watch – FMSP video 1.2 ‘Modelling with Graphs & Networks’ on our site.
Watch – FMSP video 1.3 ‘Further Modelling’ on our site
– Complete “MEI MWA Graphs – ‘Working with Graphs - Exercise level 2’ from our site.

7
Practice Questions 4 – Miscellaneous Questions

1. (a) Why must the sum of the degrees of all the vertices in any graph always be even?
(b) Deduce a result concerning the number of odd vertices in a graph.
(c) Show that in a group of nine people it is not possible for each to be friends with exactly five others.

2. Six students are choosing rooms in a shared house. Each student has given a score (from 0 to 5) to
each room. A score of 0 means that the student does not want that room under any circumstance.

R1 R2 R3 R4 R5 R6 (i) Draw a bipartite graph showing which


Alice 0 4 2 1 0 3 students do want which rooms.
Beth 0 0 3 2 0 2
Cal 2 1 4 0 3 1 (ii) Add weights to your graph to show the
Dan 0 2 0 3 5 4 students scores for the rooms they do want.
Ella 3 0 0 0 3 0
(iii) Without using a formal algorithm, find a
Fred 1 3 3 1 1 0
way to allocate the students to the rooms that
has a total score of 17.

3. Six tasks A, B, C, D, E and F are to be carried out by six people, 1, 2, 3, 4, 5 and 6. Each task requires
a different combination of people to carry it out; these people all need to work on the task at the same
time. Table 2.2 shows the tasks for which each person is required.
Each person can only work on one task at a time, so this constrains which tasks can happen at the same
time.

(i) Draw a graph to represent the situation. The Person 1 2 3 4 5 6


vertices should be the six tasks and an edge should A C A D B B
be drawn between two tasks if they have a person Tasks C D E E E C
in common (so they cannot be done at the same F F F F F F
time). So, A and C should be joined because they
both need person 1.

(ii) Draw the compliment of the graph from part (i), (iii) Use the compliment graph to organise
i.e. with the same vertices but using the edges that the tasks in an efficient way.
were not used in part (i).

4. A 90kg man (M), a 50kg woman (W) and a 40kg child (C), together with a 30kg sack of potatoes (P)
are at the top of a building. The three people need to get to the ground using a pair of large buckets,
joined by a cable that passes over a pulley. Each bucket can hold at most one person and the sack of
potatoes.

Initially, one bucket is on the ground and the other is at


the top of the building. When the upper bucket has a
larger load than the lower bucket, the upper bucket will
descend to the ground and the lower bucket will rise to
the top of the building. For safety, if any of the people
are in either bucket there must be no more than a 10 kg
difference between the loads in the two buckets.

(i) Use a 16 vertex digraph to model the situation, where the vertices are labelled to show which of M,
W, C and P are at the top of the building (and hence which are on the ground) and the directed edges
show safe transitions from one vertex to the next. So the vertices are MWCP, MWC, MCP, MW, etc and
an arrow from MWCP to MWC represents the potatoes being sent down in the bucket; while the child
can then descend in the second bucket while the potatoes travel to the top again which is shown by
an arrow from MWC to MWP.
8
(ii) Where is the sack of potatoes when the last person reaches the ground?

You might also like