You are on page 1of 40

Semester 2

Part 1 – Networks

1
Networks.

The elements of a Network:

A network is made up of dots and lines joining these dots.


 The dots in a network are called vertices (plural of vertex).
 The lines in a network are called edges.

Degree of a vertex
The degree of a vertex is the number of edges attached to the vertex.

The degree of a vertex may be even or odd.


 The degree of a vertex will be even if there are an even number of edges (2,4, 6,……)
attached to the vertex.
 The degree of a vertex will be odd if there are an odd number of edges (1, 3, 5,……) attached
to the vertex.

2
Network elements: definitions
 A network is a diagram that consists of a set of points called vertices that are joined by a set
of lines called edges. Each edge joins two vertices.
 A loop is an edge in a network that joins a vertex in a network to itself.
 Two or more edges that connect the same vertices are called multiple edges.

       
 The degree of a vertex is the number of edges attached to the vertex. The degree of a
vertex is denoted deg(V). For example, in the network
below, deg(A)=4, deg(B)=2, deg(C)=4 and deg(D)=2.
Note: A loop contributes two degrees to a vertex because a loop is attached to its vertex at
both ends.

           
 In any network, the sum of degrees of the vertices is equal to twice the number of edges.
Note: A loop contributes one edge to the network.

Describing graphs
Graphs that represent connections between objects can take different forms and have
different features. This means that there is a variety of ways to describe these graphs.

Simple graphs

Simple graphs do not have any loops. There are no


duplicate or multiple edges either.

Isolated vertex

3
A graph has an isolated vertex if there is a vertex
that is not connected to another vertex by an edge.
The isolated vertex in this graph is E, because it is not
connected to any other vertex by an edge.

Complete graphs

If there is an edge between every pair of vertices, the graph is


called a complete graph. Every vertex in the graph is connected
directly by an edge to every other vertex in the graph.

Subgraphs

A subgraph is a part of a larger graph. All of the edges and


vertices in the subgraph must exist in the original graph. If
there are extra edges or vertices, the graph will not be a
subgraph of the larger graph.

Graph 2 Graph 3 Graph 4

Graphs 2 and 3 above are subgraphs of Graph 4 above is not a subgraph of


graph 1. All of the vertices and edges in graph 11. There are two edges connecting
graphs 2 and 3 exist in graph 1. vertex A to vertex B, but in graph 11 there
is only one.

4
Exercise 1.1

1. For each network shown, complete the associated statements by filling in the boxes.
a)

1. The network has ___________


vertices.
2. The network has ___________
edges.
3. The network has ___________
loops.
4. deg(A)=   ___________
5. deg(E)=  ___________
6. The network has ___________ odd
vertices.
7. The network has ___________
even vertices.

b)

1. The network has ___________


vertices.
2. The network has ___________
edges.
3. The network has ___________
loops.
4. deg(B)=   ___________
5. deg(D)=  ___________
6. The network has ___________
odd vertices.
7. The network has ___________
even vertices.

c)

5
1. The network has ___________
vertices.
2. The network has ___________
edges.
3. The network has ___________
loops.
4. deg(A)=   ___________
5. deg(C)=  ___________
6. The network has ___________ odd
vertices.
7. The network has ___________
even vertices.

d)

1. The network has ___________


vertices.
2. The network has ___________
edges.
3. The network has ___________
loops.
4. deg(C)=  ___________
5. deg(F)=  ___________
6. The network has ___________
odd vertices.
7. The network has ___________
even vertices.

2. What is the sum of the degrees of the vertices of a network with: (In each case draw an
example of the network and check your answer.)
a) five edges?
b) three edges?
c) one edge?

3. Consider the network opposite. 

A loop is added at vertex A:


a) how will this change the degree of vertex A?

b) how many edges are added to the network?

6
4. This section of a road map can be considered
as a graph, with towns as vertices and the
roads connecting the towns as edges.

a) Give the degree of:


 Town A
 Town B
 Town H
b) What is the sum of the degrees of all the
vertices of this graph?
c) Draw a subgraph of this road map that
contains only towns H,D and C.

5. Draw a graph that:

a) has three vertices, two of which are odd


b) has four vertices and five edges, one of which is a loop
c) has six vertices, two of which are odd, and contains a subgraph that is a triangle

Trees

A tree is a connected graph that has no loops, multiple edges or


cycles.
This tree has seven vertices and six edges.
The number of edges is always one less than the number of
vertices.

Spanning trees
Every connected graph will have at least one subgraph that is a tree. A subgraph is a tree,
and if that tree connects all of the vertices in the graph, then it is called a spanning tree.
Trees
A tree has no loops, multiple edges or cycles.
If a tree has n vertices, it will have n−1 edges.
A spanning tree is a tree that connects all of the vertices of a graph.
There can be more than one spanning tree for any connected graph. The total weight of a
spanning tree is the total of all the weights on the edges that make up the tree.
 

7
Minimum spanning trees
One of the spanning trees from a particular connected graph will have the smallest total
weight. This tree is called the minimum spanning tree. Minimum spanning trees can be
found using an algorithm called Prim’s algorithm.
Prim’s algorithm for finding a minimum spanning tree
 Choose a starting vertex (any will do).
 Inspect the edges starting from the starting vertex and choose the one with the lowest
weight. (If there are two edges that have the same weight, it does not matter which one you
choose). The starting vertex, the edge and the vertex it connects to form the beginning of
the minimum spanning tree.
 Now inspect all of the edges starting from both of the vertices you have in the tree so far.
Choose the edge with the lowest weight, ignoring edges that would connect the tree back to
itself. The vertices and edges you already have, plus the extra edge and vertex it connects
form the minimum spanning tree so far.
 Keep repeating this process until all of the vertices are connected.

8
Exercise 1.2

1. A network is shown on the right.

a) How many edges must be removed in order to leave a spanning tree?


b) Remove some edges to form three different trees.
c) For each tree in part b, find the total weight.

2. Find a minimum spanning tree for each of the following graphs and give the total
weight.

a)  

b)  

c)  

9
d)  

3. In the network opposite, the vertices represent water tanks on a large property and
the edges represent pipes used to move water between these tanks. The numbers
on each edge indicate the lengths of pipes (in m) connecting different tanks.

Determine the shortest length of pipe needed to connect all water storages.
 

10
Planar graphs

A planar graph: no intersecting edges


A planar graph can be drawn on a plane (page surface) so that no edges intersect (cross),
except at the vertices.
 

Some graphs do not initially appear to be planar; for example, Graph 1 shown below left.
However, Graph 2 (below right) is equivalent (isomorphic) to Graph 1. Graph 2 is clearly
planar.

Graph 1: non-planar graph as Graph 2: planar form of


drawn Graph 11

Non-planar graph

11
Not all graphs are planar.
For example, the graph opposite cannot be redrawn in an equivalent planar form, no matter
how hard you try.
 
Faces of a graph

The graph opposite can be regarded as dividing the paper it is drawn on into two regions.
In the language of graphs, these regions are called the faces of the graph.
One face, f1, is bounded by the graph.
The other face, f2, is the region surrounding the graph. This ‘outside’ face is infinite.

The graph opposite divides the paper into four regions, so we say that it has four
faces: f1, f2, f3 and f4. Here f4 is an infinite face.

12
Euler’s formula
Euler discovered that, for connected planar graphs, there is a relationship between
the number of vertices, v, the  number of edges, e, and the number of faces, f. This relationship
can be expressed in words as:

number of vertices − number of edges + number of faces = 2


or in symbols as:
v–e+f=2
This is known as Euler’s formula. For example, for the graph
opposite:  v=6, e=8 and f=4.
v – e + f = 6 – 8 + 4 = 2 confirming Euler’s formula.

Euler’s formula
For a connected planar graph:

number of vertices − number of edges + number of faces=2


or
v–e+f=2
where v = number vertices, e = number of edges and f = number of faces

Exercise 1.3
1. Which of the following graphs are drawn in planar form?

a)  

b)  

13
c)  

d)  

e)  

f)  
2. Redraw each graph in an equivalent planar form.
a)  

b)  

14
c)  

d)  

e)  

f)  

3.  For each of the following graphs:


i. state the values of v, e and f
ii. verify euler’s formula.

a)  

15
b)  

c)  

d)  

2.  For a planar connected graph, find:

a) f given v=4 and e=4

b) v given e=3and f=2

c) e given v=3 and f=3

d) v given e=6 and f=4

e) f given v=4 and e=6

f) f given v=6 and e=11

g) e given v=10 and f=11

16
17
3. The five graphs shown below are known as the platonic (after Plato) solids.

For each graph, write down the values of v, e and f and show that they satisfy Euler’s
formula.

18
Eulerian and semi-Eulerian graphs
Eulerian graphs
A graph is described as Eulerian if it has a circuit that includes every edge once only. The
circuit in an Eulerian graph is called an Eulerian circuit.
To be Eulerian, a graph must:
 be connected
 have all vertices of an even degree.
An Eulerian circuit can start at any vertex and will also finish at that vertex.

Semi-Eulerian graphs
A graph is described as semi-Eulerian if it includes every edge once only. The trail in an
Eulerian graph is called an Eulerian trail.
To be semi-Eulerian, a graph must:
 be connected.
 have exactly two vertices of an odd degree.
An Eulerian trail must start at one of the odd degree vertices and will finish at the other odd
degree vertex.
Hint: Remember that Eulerian graphs are concerned with following edges and both begin
with “e”.

Hamiltonian paths and cycles


A Hamiltonian path involves all the vertices but not necessarily all
the edges. For example, in the graph opposite, A-B-D-C is a
Hamiltonian path. It starts at vertex A and ends at vertex C. (Follow
the arrows.)
Note: A Hamiltonian path does not have to involve all edges.

A Hamiltonian cycle is a Hamiltonian path that starts and


finishes at the same vertex. For example, in the second
graph A-C-F-E-D-B-A is a Hamiltonian cycle. It starts and
finishes at vertex A. (Follow the arrows.)
Note: A Hamiltonian cycle does not have to involve all
edges.

A Hamiltonian graph is a graph that contains a Hamiltonian cycle. A connected graph that
contains an open Hamiltonian path, but not a Hamiltonian cycle, is said to be semi-
Hamiltonian.

19
Unfortunately, unlike Eulerian trails and circuits, there are no simple rules for determining
whether a network contains a Hamiltonian path or cycle. It is just a matter of ‘trial and error’.

Applications of Hamiltonian paths and cycles


Hamiltonian paths and cycles have many practical applications. In everyday life,
a Hamiltonian path would apply to situations like the following:
 You plan a trip from Perth to Albany, with visits to Margaret River, Nannup, Bridgetown,
Denmark and Mount Barker on the way, but do not want to visit any town more than once.
Hamiltonian cycles relate to situations like the following:
 A courier leaves her depot to make a succession of deliveries to a variety of locations before
returning to her depot. She does not like to go past each location more than once.
 A tourist plans to visit all of the historic sites in a city without visiting each more than once.
 You are planning a trip from Adelaide to visit Melbourne, Canberra, Sydney, Broken Hill,
Mildura and Renmark before returning to Adelaide. You don’t want to visit any town more
than once.
In all these situations, there would be several suitable routes. However, other factors, such
as time taken or distance travelled, may need to be taken into account in order to determine
the best route. This is an issue addressed in the next section: weighted graphs and
networks.
Hamiltonian paths and cycles
Hamiltonian paths
A Hamiltonian path visits every vertex of a graph.
Hamiltonian cycles
A Hamiltonian cycle is a Hamiltonian path (every vertex) that starts and ends at the same
vertex.
Note: Inspection is the only way to identify Hamiltonian paths and cycles.
Remember: 
Eulerian trails and circuits do not repeat edges.
Hamiltonian paths and cycles do not repeat vertices.
Hint: To remember the difference between Eulerian and Hamiltonian travels, remember
that Eulerian refers to edges, and both start with ‘e’.

20
Exercise 1.4

1. Complete the table below by putting √ or X in each cell:

Must use every vertex Must use every edge

Eulerian Graph

Eulerian Cycle

Eulerian Circuit

Eulerian Trail

Hamiltonian Path

Hamiltonian Cycle

2. For each of the following graphs a to i,:

i. determine whether the network is Eulerian, semi-Eulerian or neither,


and state why
ii. if the graph is Eulerian or semi-Eulerian, show one example.
a)  

b)  

21
c)  

d)  

e)  

f)  

g)  

22
h)  

i)  

2. A road inspector lives in Town A and is required to inspect all roads connecting the
neighbouring towns B, C, D and E. The network of roads is shown on the right.

a) Is it possible for the inspector to set out from Town A, carry out his inspection by
travelling over every road linking the five towns only once, and return to Town A?
Explain.

b) Show one possible route he can follow.

3. A postman has to deliver letters to the houses located on the network of streets shown
on the right.

23
a) Is it possible for the postman to start and finish his deliveries at the same point in
the network without retracing his steps at some stage? If not, why not?
b) It is possible for the postman to start and finish his deliveries at different points in
the network without retracing his steps at some stage. Identify one such route.

4. Two islands are connected to the banks of a river by five bridges:

a) Draw a graph to represent this situation. Label the vertices A, B, C and D to


represent the river banks and the two islands. Use the edges of the graph to
represent the bridges.

b) It is not possible to plan a walking route that passes over each bridge once only.
Why not?

24
c) Show where another bridge could be added to make such a walk possible.
d) Draw a graph to represent this situation.
e) Explain why it is now possible to find a walking route that passes over each bridge
once only. Mark one such route on your graph.

5. The graph below models the pathways linking five animal enclosures in a zoo to the
kiosk and to each other.

a) Is it possible for the zoo’s street sweeper to follow a route that enables its
operator to start and finish at the kiosk without travelling down any one
pathway more than once? If so, explain why.
b) If so, write down one such route.

6. List a Hamiltonian path for the network shown.

a) Starting at A and finishing at D

b) Starting at F and finishing at G

7. Identify a Hamiltonian cycle in each of the following graphs (if possible), starting
at A each time.

25
a)  

b)  

c)  

d)  

e)  

26
f)  

9. A tourist wants to visit a winery in each of five different towns Apsley (A),


Berrigama (B), Cleverland (C), Donsley (D) and Everton (E) in a wine-growing region.
The network of roads connecting the towns is shown on the
right.
Can a tourist start a tour that visits each town only once
by starting and finishing at the following towns? If so,
identify one possible route in each case and give its
mathematical name.

a) Start at Cleverland and finish at Everton.


b) Start at Cleverland and finish at Apsley.
c) Start at Everton and finish at Everton.

10. The graph below models the pathways linking seven animal enclosures in a zoo to the
kiosk and to each other.

a) Is it possible for a visitor to the zoo to start their visit at the kiosk and see all of the
animals without visiting any one animal enclosure more than once? If so, identify a
possible route and give this route its mathematical name.

27
b) Is it possible for a visitor to the zoo to start their visit at the deer enclosure and
finish at the kiosk without visiting the kiosk or any enclosure more than once? If
so, identify a possible route and give this route its mathematical name.

28
Eulerian and Hamiltonian Cycles and Paths Summary.

Name Characteristics
Traversable Graph  Connected graph
 All vertices have even degrees OR have 2
odd vertex degrees

Eulerian Graph  Connected graph


 All vertices have EVEN degrees
 Every edge is used ONCE ONLY

Eulerian Circuit  Every edge is only used ONCE and it starts


and finishes at the same vertex
 All vertices have even degrees

No REPEAT EDGES

Semi-Eulerian Graph  Connected


 2 vertices have ODD degrees

Eulerian Trail  Semi-Eulerian Graph


 Open trail
 Every edge is used once only

No REPEAT VERTICES

Hamiltonian Path  Every Vertex is touched ONCE ONLY

Hamiltonian Cycle  Start and End at the SAME vertex as well


as touching every vertex ONCE ONLY

29
Critical Paths – Project Planning.

Drawing activity networks from precedence tables


Building a house, manufacturing a product, organising a wedding and other similar projects
all require many individual activities to be completed before the project is finished. The
individual activities often rely upon each other and some can’t be performed until other
activities are complete.

Activit Immediate
y predecessors

A −−

B −−

C A

D B

E B

F C,D

G E,F

In the organisation of a wedding, invitations would be sent out to guests, but a plan for
seating people at the tables during the reception can’t be completed until the invitations are
accepted. When building a house, the plastering of the walls can’t begin until the house is
sealed from the weather.
For any project, if activity AA must be completed before activity BB can begin then
activity AA is said to be an immediate predecessor of activity BB. The activities within a
project can have multiple immediate predecessors and these are usually recorded in a table
called a precedence table.
This precedence table shows some of the activities involved in a project and their immediate
predecessors.
The information in the precedence table can be used to draw a network diagram called
an activity network.
Activity networks do not have labelled vertices, other than the start and finish of the project.
The activities in the project are represented by the edges of the diagram and so it is the
edges that must be labelled, not the vertices.
Activities A and B have no immediate predecessors.
These activities can start immediately and can be completed at the
same time.

30
Activity A is an immediate predecessor of activity C, so activity C
must follow immediately after activity A.
Activity C is an immediate predecessor of activity F, so activity F
must follow immediately after activity C.

Activity D has immediate predecessor activity B so it follows


immediately after activity B.
Activity D is also an immediate predecessor of activity F so
activity F must follow immediately after activity D.

Activity E has immediate predecessor activity B so it will follow


immediately after activity B.
Activity G has immediate predecessor activity F and activity E and
so it must follow immediately after both of these activities.

Activity G is not an immediate predecessor for any activity and so the project is finished
after this activity is complete.
Activity networks
When activity A must be completed before activity B can begin, activity A is called
an immediate predecessor of activity B.
A table containing the activities of a project, and their immediate predecessors, is called
a precedence table.
An activity network can be drawn from a precedence table. Activity networks have edges
representing activities. The vertices are not labelled, other than the start and finish vertices.

Exercise 1.5

1. Write a precedence table for the activity networks shown below.

1.  

2.  

31
3. Draw an activity network for each of the precedence tables below.

a)

Immediate
Activit predecesso
y rs
A −−
B A
C A
D B
E C

b)

Immediate
Activit predecesso
y rs
P −−
Q −−
R P
S Q
T R, S

c)

Immediate
Activit predecesso
y rs
T −−
U −−

32
V T
W U
X V, W
Y X
Z Y

d)

Immediate
Activit predecesso
y rs
F −−
G −−
H −−
I F
J G, I
K H, J
L K

33
Exercise 1.6

1. When a personal computer is being assembled the following processes must be performed:

34
Construct a network diagram and determine the minimum time in which all tasks could be
completed (forward scan)

2. Refer to the diagram on the right.

a) Use forward scanning to


determine the earliest
completion time

b) Identify any tasks that may be delayed without increasing the earliest completion
time.
3. In the network below complete a forward scan and hence, find the earliest completion
time for the project.

35
Example:

36
37
Exercise 1.7
1.

2.

38
3.

4.

5.

39
6.

40

You might also like