The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.
Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by nurul_aina_rozhan, 2022-01-04 03:59:00

BIRTHDAY PARTY PLANNING VIA GRAPH THEORY

Individual assignment

BIRTHDAY
PARTY

PLANNING

VIA GRAPH THEORY

BY: NURUL AINA BINTI ROZHAN (280384)

CONTENT

INTRODUCTION

GRAPH THEORY
TYPE OF GRAPH

STORYLINE GRAPH REP
RESENTATION


ADJECENCY LIST
SHORTES
T PATH ADJECENCY MATRICES
dijkstra's algorithm
GRAPH COLOURING



REFLECTION

SPANNING TREE
KRUSKAL'S A
LGORITHM






REFERRENCES

INTRODUCTION
GRAPH THEORY

The study of graphs is known as graph theory. A
graph is defined as a mathematical structure that
connects a group of points to express a specific
function. It's used to link objects together in a
paired relationship. The graph is made up of
vertices (nodes)that are connected by the and
edges (lines). The endpoint is said to be
connected by each edge. Graph theory has
numerous applications in our daily lives,
including mathematics, computer science, physics
and chemistry, linguistics, biology, and so on.

THESE ARE THE TYPE OF THE GRAPHS:

SOURCE FROM: GOOGLE IMAGE

STORYLINE

A few days ago, Aina and her friends has
decided to make a birthday party for their

bestfriends, Amira.

So there is a few planning that Aina
had done to make sure that the party

went smoothly:

LIST TO DO

-Buying the things for the
preparation
-Bringing a variety of food
from their house
-Giving all the goodies to all
their friends

GRAPH REPRESENTATION

A graph can be represented in three ways, which
are adjacency matrices, incidence matrices, and
adjacency list

During this planning for the party,
Aina had using Whatsapp apps to communicate with all her

friends , she
personally has message everyone to inform about the
planning that they will do to make sure that Amira not
accidently know about this planning. Her friends also do the

same thing as she had done.



FIGURE 1: WHATSAPP CONNECTION.

From the figure above, we
can represent it into a

graph. The graph is contains
10 vertices and 14 edges.
.

Now we will use ADJACENCY LIST and ADJACENCY MATRICS
method to represent this graph

.

• ADJACENCY LIST

An adjacency list can be
used to represent a graph
with no multiple edges by
specifying the vertices that
are adjacent to each vertex
of the graph.

• ADJACENCY M A T R
I C S

.

Adjacency matrices are used to

represent a graph with loops and

multiple edges. In a 2D array, an

adjacency matrix is a technique for

describing the relationships

between the vertices. If there is a

connection between vertices I and j

in an unweighted graph, the value

of the cell [i, j] will be 1, but if

there isn't, it will be 0.

SHORTEST PATH

The shortest path is the path with the least length
between two vertices. Usually, this shortest path
will be used to solve a problem that is related to
time, distance, and so on. There are a lot of
algorithms that can be used to find the shotest path,
but the most common is Dijkstra’s algorithm.

DIJKSTRA’S ALGORITHM

Dijkstra’s algorithm can be applied to a weighted
graph. The graph can be either directed or
undirected. One stipulation to using the algorithm
is that the graph needs to have a nonnegative
weight on every

Step to use
Dijkstra’s algorithm :

1st step: Calculate the distance using the
algorithm.
2nd step: Choose the first node and
calculate the distance between it and the
others.
3rd step: Choose the next node with the
smallest distance and calculate the
distance between adjacent nodes again.

Before they go to the party place, the important thing that
they must do is buy some decorations and also some goodies
for their friends. There are a few shops that sell those kinds
of things. Aina decided to go to only a few shops from her
house that were near the party location. It is to make sure

that she doesn’t take too much time to go to the party
location and can prepare the things before Amira gets there.



So, Aina had to apply the Dijkstra’s algorithm to find the

shortest path.

Here is the map to go to the shops...

Aina's =A
house =B
=C
The party
location =D
=E
Figure 2 =F

=G

This graph is 0.5 2 1
represented 2
by 0.5 1.5
figure 2 2.5 1 1.5

2.5
2

0.5

The table shows the distance based on the
previous graph

So here's the result after we apply the dijkstra's algorithm

0.5 2 1
2
0.5 1.5
2.5 1 1.5

2.5
2

0.5

ABC DG

Based on the graph above, assume that the orange line is
the shortest path that we get.
So the calculation for the shortest path is:

0.5 +0.5+1+0.5 = 2.5
So it means that, the shortest path between A and G is 2.5.

So, Aina will go to the shop B, C and D to buy all the
stuff because this path has the minimum sum of weight,
which is 2.5 km compared to the others path between A

and G.

GRAPH COLOURING

Graph colouring is the procedure of assigning
colours to each vertex of a graph G such that no
adjacent vertices get the same color. The objective
is to use as few colours as possible when colouring a
graph. The chromatic number of a graph G is the
least number of colours required to colour the
graph.

Aina and her friends have also discussed the type of food
that will be prepared by them. After having a few

discussions, they agreed to bring their own food from their
house to save on their budget. But the problem is that

they are worried that everyone will bring the same type of
food. From this situation, it can be illustrated in graph
colouring.



1os2trt3nhtdordhteescndooeGtrospfe.rasltilrSpottneaotit:uephwympieprA:efeah.op:rsSrvfaTrtPyceetla-hitllorocnncehitlskoogcueiuofltecmptosvuethbrtuteesrhoheehrricere.hetnneeianfedgcgdviexeru:eracastrsorpebtnvlbheoeesyve'urahsentrvrorveebutctxeryelohrtd.xlaatioAcnitbaucesdenrehssedsaricdhgeosfianpnlniovel' atulesarotibntmteeihedteewewnwuisctniauohttmslhioeelud r l l
a

So what they did is they had set rules that only certain
people would bring the same type of food. Aina had set the
menu for this party, which included junk food and drinks,
dessert and cake, and a main dish. Only these 3 menus will

be their food for the parties. So, it means that the
chromatic number for this graph is 3.

Assume that:
•Junkfood & Drink =

•Cake & Dessert =

•Main dish =

This graph is
represented from
this graph

So here is the results after implementing the graph
colouring method:






Based on the table above, it shows that the type of food
that they need to bring to the party is equally divided
among the 10 people who come to the party. It means that

they successfully diversify the types of food for that
party.

SPANNING TREE

A spanning tree is a sub-graph of an undirected
connected graph that includes all the vertices
of the graph with the minimum possible number
of edges, but it will not form a cycle. If a
vertex is missed, then it is not a spanning tree.

MINIMUM SPANNING TREE

A minimum spanning tree is a
spanning tree in which the sum of
the weight of the edges is as small
as possible.

The example of minimum spanning tree for K4:

KRUSKAL’S ALGORITHM

Kruskal's algorithm is a minimum-spanning tree
algorithm that takes a graph as input and discovers
the subset of the graph's edges that form a tree with
every vertex. And among all the trees that can be
built from the graph, it has the smallest sum of
weights.

Step to use
kruskal’s algorithm :
1st step: Sort all of the edges from low weight to
high.
2nd step: Join the spanning tree with the edge
with the least weight. If adding the edge creates
a cycle, it should be rejected.
3rd step: Keep adding edges until we've reached
all of the vertices.

After the party was ended, there were 10 goodies left. All
the goodies belong to their 10 friends that can’t join them.

So they decided to send all the goodies to their friends’
houses. They need to come back home 20 minutes before
midnight, but the problem is that not everyone knows the
shortcut to go to their friends’ house. So, Aina had to apply

Kruskla's algorithm to solve this problem.

The figure 3 shows the path to go to Aina's friends house.

=A =F
=B =G
=C =H

=D =I
=E =J

FIGURE 3

6

This graph is 3 2
the represented 2
by figure 3 5

2 3 2
2

2 43 3
2

32 3

25

Here's the minimum spanning tree after the
Kruskal's algorithm had been apply to this graph

6

3 5
2

2 3 22

24 3 23
3 2
23

25

THE MINIMUM 2 2 2 2
SPANNING TREE : 2 3



2
n-1 = edges 2
10 - 1 = 9 edges
2

The total minimum spanning tree is
2 + 2 + 2 + 2 + 3 + 2 + 2 +2 + 2 = 19

So, the time taken for Aina and her friends to deliver
all the goodies left is 19 minutes. That is, they got
home less than 20 minutes before midnight.

Source: Story by Freepik

A picture memory for this party

REFLECTION

I think that after completing this project, I get
more knowledge from it. It's because, before I

started doing this task, I just had a basic
understanding of this topic. However, after
doing this task, I realised that this topic is
quite interesting and I am almost understand
the whole things in this topic, which makes me

want to study more about it.
Apart from that, my editing skills have
improved because I've explored many things
while preparing for this task and the previous
task in this subject. Actually, I was almost fed
up with this assignment because I had no idea
what to do with it, but after doing a lot of
research on it, Alhamdullilah, I began to have
an idea to fit the scenario that was related to
the graph theory concept for this task. Last but
not least, I'd like to express my gratitude to
my lecture, Prof. Haslinda, for teaching me
creatively for this semester, even though we
are doing this online learning. Overall, I am

really enjoying doing this task.

REFFERENCES

• Graph model-https://www.youtube.com/watch?v=

• Kenneth H. Rosen.(2019)Discrete Mathematics And
Its Applications, 8th Edition

• Thaddeus abiy.(2020).Dijkstra's Shortest Path
Algorithm. Retrieved from
Dijkstra's Shortest Path Algorithm | Brilliant Math &
Science Wiki

• Programiz.(2020).Spanning tree and minimum
spannin tree. Retrieved from
https://www.programiz.com/dsa/spanning-tree-and-
minimum-spanning-tree

• Jus.com.(2021).Graph Theory
https://byjus.com/maths/graph-
theory/#:~:text=Graph%20Theory%2C%20in%20discre
te%20mathematics,a%20pairwise%20relationship%20b
etween%20objects.

• Joe gorst(2021) .Adjacency Matrices Explained.
Retrieved from A Representation of
Adjacency Matrices Explained:
Graphs (opengenus.org)


Click to View FlipBook Version