MAT668-assignment
MAT668-assignment
GROUP: 2
CS2496B
NAME STUDENT ID
LECTURER BY:
ASSOC. PROF. TS. DR. ADIBAH SHUIB
TABLE OF CONTENT
TABLE OF CONTENT 2
QUESTION 1 3
1.0 INTRODUCTION 3
1.1 OBJECTIVES 3
1.2 LITERATURE REVIEW 4
Graph Coloring 4
Vertex Coloring 4
Edge Coloring 5
Graph Initialization 5
2.0 METHODOLOGY 7
2.1 Conflict graph 7
2.2 Graph Coloring 11
2.3 Graph Coloring using Python 13
3.0 CONCLUSION 23
QUESTION 2 23
1.0 INTRODUCTION 23
1.1 OBJECTIVES 24
1.2 LITERATURE REVIEW 24
Graph Theory 24
Four Color Theory 25
Graph Coloring 25
Greedy Theorem 26
Euler’s Theorem 26
2.0 METHODOLOGY 27
2.1 Data and Descriptions of data 27
2.2 Explanation of steps using Python 28
2.3 Python coding and output 30
2.4 Vertex coloring 32
2.5 Graph Coloring 35
3.0 RESULTS 35
4.0 CONCLUSION 36
5.0 REFERENCES 37
QUESTION 1
1.0 INTRODUCTION
Vertex coloring in graph theory entails assigning colors to the vertices of a graph in such
a way that adjacent vertices are not assigned the same color. The act of assigning colors in the
graph is referred to as vertex coloring in formal terms. Generally, numerical values are employed
to represent various hues. Furthermore, we assign colors to the vertices in a manner that
guarantees that neighboring vertices are never filled with the identical color. The chromatic
number represents the smallest possible number of colors required to color the vertices of a
graph. Usually, this value continuously exceeds one. The chromatic number of a graph will be
equal to one only when the graph consists of a single vertex.
1.1 OBJECTIVES
a. Prepare a list of 20 student names and complete Table 1 by marking 'X' for courses taken
by each student.
b. To draw a conflict graph manually illustrating shared students between exams and
analyze its structure and implications
c. To determine the minimum number of time slots for scheduling exams using manual
graph coloring, implement the solution in Python, and compare the results.
1.2 LITERATURE REVIEW
Graph Coloring
Ann et al.,(2022) stated that graph coloring, a dynamic sub-branch of graph theory, has
seen significant advancements and applications across various fields such as chemistry and
computer science. Originating from Leonhard Euler's 1736 paper on the Königsberg bridge
problem, which laid the foundation for graph theory, this field has evolved substantially. Graph
coloring began with the four-color conjecture proposed by Francis Guthrie, stating that any map
can be colored using no more than four colors such that no adjacent regions share the same color.
This conjecture, which spurred extensive research by scientists including Augustus De Morgan
and William Hamilton, was eventually proven in 1976 by Kenneth Appel and Wolfgang Haken
with the aid of computer assistance, marking the first major computer-assisted proof. Since then,
concepts like chromatic polynomials have emerged, maintaining graph coloring as an active area
of research with numerous practical applications in everyday life.
Vertex Coloring
Ann et al., (2022) also stated that graph coloring typically refers to vertex coloring, which
is a method of assigning colors to the vertices of a graph in such a way that no two adjacent
vertices (vertices connected directly by an edge) share the same color. This ensures that each pair
of connected vertices is distinguishable by their colors, helping to solve problems where conflict
or overlap must be avoided. For example, in scheduling problems, each vertex could represent a
task, and an edge between two vertices indicates that the tasks cannot occur simultaneously. By
coloring the graph, we ensure that no two conflicting tasks are assigned in the same time slot.
This principle can be applied to various real-world scenarios, such as map coloring where
regions sharing a border must be colored differently to distinguish them, or in network design to
minimize interference.
Edge Coloring
An edge coloring is the assignment of colors to the edges of a graph such that no two
incident edges (edges sharing a common vertex) share the same color. This method is essential
for avoiding conflicts in various applications where shared resources or connections must be
managed without overlap. In the scheduling context, edge coloring ensures that tasks represented
by edges do not share the same time slot if they are connected to a common resource or machine
represented by a vertex. For example, in a factory setting, each job (edge) that requires the same
machine (vertex) at the same time must be scheduled in different time slots, which can be
effectively managed using edge coloring techniques. Ann et al., (2022).
Graph Initialization
Graph initialization is a critical step in graph theory and its applications, laying the
groundwork for various algorithms and analyses. The process involves setting up a graph’s basic
structure, which includes defining vertices, edges, and their relationships. According to Cormen
et al. (2009), the initialization phase is crucial for ensuring the efficiency and accuracy of
subsequent computational processes. Initializing a graph correctly can significantly influence the
performance of algorithms such as those for shortest path, spanning tree, and network flow
problems. Techniques for graph initialization vary, from simple adjacency matrices and lists to
more sophisticated data structures like edge lists and incidence matrices, each offering distinct
advantages in terms of memory usage and access speed. Furthermore, in dynamic applications
such as social networks and communication systems, initialization must account for potential
changes in the graph’s structure over time, necessitating robust and adaptable initialization
methods (West, 2001). Overall, effective graph initialization forms the foundation for successful
implementation and analysis in graph-theoretical research and practical applications.
University Teknologi MARA (UiTM) offered mathematical studies in the College of Computing,
Informatics, and Mathematics (KPPIM). The enrollment of mathematics students in a semester
has been done at the beginning of their undergraduate studies. In the current semester, a total of
20 mathematics students have been registered for their undergraduate studies.
STUDENT NAMES
S5 AIMAN B. AMZANI
Among the 20 enrolled students, there is a rich diversity of backgrounds and interests. Each
student has selected a unique combination of courses based on their academic goals and
requirements. The mathematics courses (MAT111, MAT112, MAT113) must be taken by each
student. Similarly, ICT courses (ICT114,ICT115), English courses (ENG116, ENG117), Science
courses (PHY118, BIO119, CHM120), and Social Science courses (PSY121,SOC122). Each
student takes exactly one course from each category. It is crucial to take note of the courses taken
by students to schedule examination plans at the end of the semester. They are required to sit for
the exam of each course they take. The university must make sure the exam time slots are
well-organized to make sure no students overlap their final exam.
MAT111 X X X X X X X
MAT112 X X X X X X X
MAT113 X X X X X X
ICT114 X X X X X X X X X X
ICT115 X X X X X X X X X X
ENG116 X X X X X X X X X X
ENG117 X X X X X X X X X X
PHY118 X X X X X X X
BIO119 X X X X X X X
CHM120 X X X X X X
PSY121 X X X X X X X X X X
SOC122 X X X X X X X X X X
In table 2, the courses taken by each student are marked with ‘X’. The adjacency matrix is
created by the provided table. The matrices explain the conflicts of the courses shared by
students. The matrix is filled with '1' signifying the conflicts and '0' means no conflict. Figure 1
below shows the adjacency matrix indicating the conflicts. The network conflict graph will be
drawn based on the adjacency matrix.
Figure 1. Adjacency matrix
The time slots for the final examination must be scheduled effectively. We utilized task
scheduling to help allocate the time slots. The conflict graph is a way to visualize the conflicts or
incompatibilities among a set of entities (courses). Each vertex in a conflict graph represents the
available courses, which are 12 courses. Based on table 2, each course is denoted as ‘A’,’B’, and
onwards. An edge between two vertices indicates that there is a conflict between the
corresponding courses. This means that the two courses cannot co-exist in the same time slots.
Figure 2 illustrates the network of the conflict graph based on figure 1 which was drawn
manually.
Figure 2. The conflict graph
Each vertex has conflicts. We created the conflict graph from the table of students' course
enrollments by representing each course as a vertex and connecting vertices that share students.
Since each student takes one course from each category (Mathematics, ICT, English, Science,
Social Science), we find conflicts by identifying pairs of courses taken by the same student. If a
student takes two courses, we draw an edge between those courses to show a scheduling conflict.
By repeating this for all students, we get a graph where edges highlight these conflicts. To
schedule exams without overlaps, we use graph coloring, assigning different colors (time slots)
to adjacent courses. The chromatic number of the graph tells us the minimum number of time
slots needed to avoid conflicts, helping us create an optimal schedule. In the next section, the
findings from graph coloring will be discussed.
The minimum number of time slots is required in scheduling. It can be solved by utilizing the
graph coloring method. Vertices(courses) that share the same color can conduct the exam in the
same time slots. We can figure out the total of time slots to be conducted during the final exam
session. Figure 3 shows the implementation of graph coloring (manually) to the conflict graph.
Figure 3. The graph coloring (manually)
By solving the graph coloring manually, we managed to get 5 colors without having the
neighboring vertices having the same color. The graph requires 5 colors instead of 4 because it is
non-planar. This means that it cannot be drawn on a plane without some edges crossing, so the
Four Color Theorem does not apply. According to Cho et al. (2022), they appeal to the
correlation of conflict-free graphs and four color theorems. The conflict-free graph will have the
proper coloring such that the non isolated vertex will have different color within its
neighborhood. This concludes that the conflict-free graph follows the four color theorem. The
conflict graph does not necessarily follow the four color theorem due to its representation of
conflicting entities. In non-planar graphs, more complex connectivity patterns may appear such
as complete subgraphs 𝐾5 or other complex structures that require additional colors. Based on
the graph, it becomes clear that an additional color is necessary to prevent adjacent vertices from
having the same color. Hence, a total of 5 colors is needed.
(they discussed and proved where a non-planar graph does not follow four color theorem due to
its conflicting entities unlike the planar graph. They make a conclusion, where conflict graph
may need additional colors to prevent adjacent vertices from having the same color.)
The 5 colors that we obtain represent 5 distinct time slots. We begin by assigning colors to each
vertex in the graph. The vertices A, B, and C are labeled with a dark red color, indicating that
they can be scheduled together. The vertices G and K are coloured yellow, representing another
time slot. The vertices D and L are pink, while H,I, and J are cyan. Lastly, the vertices E and F
are labeled with a purple color. Every color corresponds to a distinct time slot, ensuring that
exams within the same slot do not overlap. By grouping the vertices with the same color, we
form a table of lists on the time slot (vertices) for the exam schedule that can be conducted
simultaneously without any scheduling conflicts.
We solve this graph colouring problem using Python to see if the answer we obtain aligns with
the graph colouring that we have done manually. Before we run the python coding, we list out
the graph edges which we obtain from the graph based on a line connecting two vertices. Then,
we run the python coding with the list of edges.
for v in range(n):
print(f'Color assigned to vertex {chr(v + ord("A"))} is
{colors[result[v]]}')
1. Graph Initialization:
○ A graph object is represented by a class named ‘Graph’.
○ Initialization of the adjacency list ‘adjList’ for the graph is done by the
constructor ‘__init__’. For every vertex in the list, there are empty lists.
○ The edges provided are added to the undirected graph by appending adjacent
vertices to each other’s adjacency lists.
2. Color Assignment:
○ The ‘colorGraph’ function assigns colors to the vertices of the graph.
○ A dictionary called ‘result’ is used to track the color assigned to each vertex.
○ For each vertex ‘u’, it determines the colors of every adjacent vertex and stores
them in a set called ‘assigned’.
○ Next, it selects the first color (starting from 1) that is not already used for a
vertex's neighbour.
○ The color assigned to vertex ‘u’ stored in the ‘result’ dictionary.
3. Greedy Coloring Algorithm:
○ The algorithm uses a greedy approach to color the vertices.
○ It applies color assignments based on adjacent vertices, iterating over all vertices.
○ The goal is to minimize the number of colors used while maintaining a difference
in color between adjacent.
4. Main Execution:
○ The function (if__name__==’__main__’ :) initiates entry point for execution.
○ The letters "A" through "L," which correspond to numerical indices, are used to
indicate the graph edges.
○ The ‘Graph’ class and the provided edges are used to construct the graph.
○ Using the greedy algorithm, the ‘colorGraph’ function is called to color the graph.
Based on the results from the Python script, we can see that the results are exactly the same as
the results from drawing the graph manually. Both methods conclude that 5 time slots are needed
to fit all 12 exams without overlapping. This ensures that all students are able to attend their
examinations in order to fulfill the requirement for passing the semester.
We modify the python coding from above so that the python color the graph by itself.
import networkx as nx
import matplotlib.pyplot as plt
if __name__ == '__main__':
# List of graph edges with alphabetic labels
edges = [
('A', 'D'), ('A', 'F'), ('A', 'H'), ('A', 'K'), ('A', 'E'), ('A',
'G'), ('A', 'L'),
('B', 'E'), ('B', 'G'), ('B', 'I'), ('B', 'L'), ('B', 'D'), ('B',
'F'), ('B', 'K'),
('C', 'D'), ('C', 'F'), ('C', 'J'), ('C', 'K'), ('C', 'E'), ('C',
'G'), ('C', 'L'),
('D', 'F'), ('D', 'H'), ('D', 'K'), ('D', 'I'), ('D', 'J'),
('E', 'G'), ('E', 'H'), ('E', 'I'), ('E', 'J'), ('E', 'L'),
('F', 'H'), ('F', 'I'), ('F', 'J'), ('F', 'K'),
('G', 'H'), ('G', 'I'), ('G', 'J'), ('G', 'L'),
('H', 'K'), ('H', 'L'),
('I', 'K'), ('I', 'L'),
('J', 'K'), ('J', 'L')
]
Table 4. The time schedule of the final exam based on python coding
This activity shows how useful coloring graphs can be in academic scheduling by
showing how well it can solve difficult scheduling problems. Finding the chromatic number gave
us a clear way to solve the test scheduling problem, making sure that it was fair and possible for
all students. The implementation and analysis that went well show how important graph theory is
for solving problems in the real world. They also give us useful information about both the ideas
behind graph theory and how they can be used in real life. This project not only showed how
useful graph coloring can be in school, but it also showed how useful graph theory is in many
other areas, like logistics, network design, and resource allocation.
QUESTION 2
1.0 INTRODUCTION
Graph theory is a fundamental branch of mathematics that explores the properties and
applications of graphs, which are structures consisting of vertices (or nodes) and edges that
connect pairs of vertices. This theory is pivotal in various fields such as computer science,
biology, and social sciences due to its ability to model complex relationships and interactions.
The map coloring problem is one of graph theory's most exciting challenges. This challenge
requires coloring the regions of a map so that no two adjacent parts have the same color. The
answer to this problem introduces the concept of the chromatic number, which is the smallest
number of colors required to produce the desired coloring with no contiguous regions sharing the
same color. Planar graphs are very beneficial for tackling the map coloring problem. Planar
graphs can be drawn on a plane with no edges crossing, making them perfect for representing
maps.
This project focuses on planar graphs and their duals. A dual graph is created by
translating an initial planar graph's faces into vertices and shared borders into edges. This
transformation makes it easier to analyze and solve coloring problems by giving you a new
viewpoint on how areas interact. The project entails implementing the greedy method in Python
to color the vertices of the dual graph with the goal of using as few colors as feasible. This
practical application of graph theory will demonstrate the usefulness of heuristic algorithms in
tackling complicated coloring problems, as well as providing insights into system optimization.
1.1 OBJECTIVES
a. To determine the dual graph of a map with at least 20 regions by precisely mapping
common boundaries to edges and areas to vertices.
b. To implement the greedy algorithm in Python to color the vertices of the dual graph and
calculate the chromatic number, which is the smallest amount of colors required.
c. To apply vertex coloring to the original map to guarantee that adjacent regions are
different colors, and document the procedure and results in a thorough report.
1.2 LITERATURE REVIEW
Graph Theory
Guo and Tang (2023) say that the four-color theorem has been an important part of graph
theory ever since it was first proposed in 1852. It says that any planar map can be colored with
no more than four colors, and no two nearby areas can share the same color. Compared to earlier
proofs, like the computer-assisted proof by Appel and Haken (1976), Guo and Tang's proof
stands out because it uses strict combinatorial methods and doesn't rely too much on computers.
Advanced combinatorial methods are used in Guo and Tang's approach. For example, planar
graphs are broken up into smaller subgraphs that are easier to handle and color. They take the
coloring strategy from these easier parts and apply it to more complicated graphs using a
systematic reduction method along with induction. This paper shows that the four-color theory is
true because the graph can't be drawn with five colors.
Graph Coloring
Greedy Theorem
West (2021) explains the Greedy Theorem, which is commonly used in algorithms for
problems like graph coloring and minimum spanning trees. The theorem outlines how a greedy
approach—one that makes the locally optimal choice at each step—can lead to an overall
optimal solution in certain cases. West details various applications of the Greedy Theorem in
graph theory, including its role in efficiently solving problems by prioritizing immediate benefits,
which helps simplify complex tasks without compromising on the overall solution quality. This
resource is ideal for those looking to understand both the theoretical foundations and practical
implementations of greedy algorithms in graph theory.
Euler’s Theorem
Euler's Theorem provides a fundamental relationship in graph theory for planar graphs,
expressed by the Euler characteristic formula |𝑉| − |𝐸| + |𝐹| = 2 where |𝑉| represents the
number of vertices, |𝐸| the number of edges, and |𝐹| the number of faces in a graph 𝐺. This
formula holds true regardless of the specific arrangement of the planar graph, as long as the
edges and vertices are repositioned without crossing each other. This invariance underscores the
theorem's robustness and significance, ensuring that the relationship between vertices, edges, and
faces remains accurate despite any non-intersecting transformations of the graph (Pickard, 2022).
This principle is crucial in various applications such as network design and topology, where
maintaining planar characteristics is essential.
2.0 METHODOLOGY
2.1 Data and Descriptions of data
1. Type of graph:
- The graph used in this report is planar. Planar graphs can be drawn on a plane
without any edges crossing each other.
2. Sources of data:
- The graph is collected from:
https://www.researchgate.net/figure/A-maximal-outerplanar-graph-shown-in-blac
k-Its-dual-is-shown-in-red-Color-figure-online_fig1_366320943
- The graph comes from a selected map with 22 regions, it was chosen to illustrate
the map coloring process.
3. Vertices:
- The original graph has 22 vertices. Each vertex in the original graph represents a
region on the map.
4. Edges:
- The original graph has 30 edges. It can be calculated using Euler’s formula,
(𝑉 − 𝐸 + 𝐹 = 2).
- For edges, it represents the adjacency relationships between regions.
- The origin graph shows an edge between two vertices if the corresponding regions
share a boundary.
- In the dual graph, an edge exists between two vertices if the corresponding
regions in the original map are adjacent.
5. Dual graph:
- The dual graph is constructed from the original planar graph by converting each
face into a vertex and each shared boundary into an edge.
6. Chromatic number:
- (χ(𝐺)) the minimum number of colors needed to color the graph without two
adjacent vertices sharing the same color.
7. Greedy algorithm:
- They are used to color the dual graph’s vertices, aiming to use the fewest colors
possible.
8. Python implementation:
- The coloring process is automated using the Python code.
➔ Step 2: Count the degree and define the possible color. Each item in the list "𝑑𝑒𝑔𝑟𝑒𝑒"
indicates the degree (number of edges) of the corresponding node. The numbers in each
row of the adjacency matrix are added up to get this number. This is a dictionary called
"colorDict" that gives each node a list of different colors. Initially, each node can be
colored “Blue”, “Pink”, “Green”, “Brown”.
➔ Step 3: Sort the node. The list "𝑠𝑜𝑟𝑡𝑒𝑑_𝑛𝑜𝑑𝑒𝑠" is made up of nodes that are arranged in
decreasing order by their degree. When coloring, nodes with higher degrees are looked at
first.
➔ Step 4: The main process. “theSolution” is a dictionary to store the final color of each
node. The outer loop goes through each of the 𝑛 nodes in 𝑠𝑜𝑟𝑡𝑒𝑑_𝑛𝑜𝑑𝑒𝑠. The greedy
method is used here by going through the nodes in order of their degrees, giving them the
first colour that is available, and then updating the possible colours of nodes that are next
to them.”setTheColor” retrieves the list of possible colors for node 𝑛. The first color in
the list is assigned to n (𝑠𝑒𝑡𝑇ℎ𝑒𝑐𝑜𝑙𝑜𝑟[0]). “adjacentNode” gets the adjacency list of node
𝑛. The inner loop iterates through each element in the adjacency list. If an edge exists
(𝑎𝑑𝑗𝑎𝑐𝑒𝑛𝑡𝑁𝑜𝑑𝑒[𝑖] == 1 or 𝑎𝑑𝑗𝑎𝑐𝑒𝑛𝑡𝑁𝑜𝑑𝑒[𝑖] == 2), it identifies the neighbor node.
To stop the same colour from being used for neighboring nodes, it removes the assigned
colour from the neighbor's list of available colours if it is present.
➔ Step 5: Print the Solution. The solution is presented with the node names listed
alphabetically. Every node is shown together with the colour it is assigned.
# Adjacency Matrix
G = [
[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2],
[1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
[0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
[0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
[0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0],
[0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2],
[0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
[0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1],
[0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1],
[0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1],
[0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1],
[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,2],
[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,2],
[0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,2],
[0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,2],
[2,1,1,1,0,2,1,0,1,1,0,1,1,0,2,2,1,1,2,1,2,0]
]
Node a = Pink
Node b = Green
Node c = Pink
Node d = Green
Node e = Blue
Node f = Pink
Node g = Green
Node h = Pink
Node i = Green
Node j = Pink
Node k = Blue
Node l = Pink
Node m = Green
Node n = Blue
Node o = Pink
Node p = Pink
Node q = Pink
Node r = Green
Node s = Pink
Node t = Pink
Node u = Green
Node v = Blue
From the outputs, we can determined the chromatic number, 𝜒(𝐺) is 3. The chromatic number is
the minimum number of colors required to color the vertices of a graph where no two adjacent
vertices share the same color. In the following section, the graph chosen is colored according to
output in python.
We implemented the python output to color the vertex of the dual graph. The vertex coloring is a
method of assigning colors to the vertices of a graph such that no two neighboring vertices share
the same color. In planar graphs, the concept of using dual graphs aids in solving the vertex
coloring problem. The dual graph simplifies the coloring process of complex planar graphs. The
application of four color theorems in this problem describes the behavior of planar graphs. This
theorem states that any planar graph can only have four vertex colors at most. This is related to
the fact that the dual graph of a planar graph can be colored with four colors.
First, the faces or vertices of the original graph G (planar graph) are identified. We observed that
graph G contains 22 faces including the outer region. Each of face in the graph G becomes a
vertex in the dual graph, denoted as G*. We added the edges between the vertices of graph G*.
The two faces share a common edge in graph G corresponds to the vertices in graph G* to be
connected by an edge. Each vertex in graph G* must cross all the existing edges of the graph G.
The vertices of G* with the edges of graph G facing the outer region will be connected to the
vertices v. Figure 8 shows the dual graph of the planar graph that we chose.
The vertex coloring is done by ensuring there is no neighbor vertices of graph G* share the same
color. The vertex coloring of the graph G* corresponds to the faces of the graph G. Figure 9
shows the vertex coloring of the dual graph.
Figure 9. Vertex coloring of dual graph
2.5 Graph Coloring
Graph coloring is specific to planar graphs. The main objective is to color the faces of the graph
G such that no two faces sharing a common edge have the same color. In this report, we apply
Greedy Algorithms into the coding in Python. We use the vertex coloring information from the
dual graph to guide the graph coloring of the original graph. The presence of three colors
observed in the graph coloring corresponds to the vertex coloring in the previous figure. The
Figure 1 shows the result of our graph coloring.
The following vertex coloring outcomes were attained by applying the greedy algorithm to the
map coloring problem: Green for nodes 𝑏, 𝑑, 𝑔, 𝑖, 𝑚, 𝑟, 𝑢; Blue for nodes 𝑒, 𝑘, 𝑛, 𝑣; and Pink
for nodes 𝑎, 𝑐, 𝑓, ℎ, 𝑗, 𝑙, 𝑜, 𝑝, 𝑞, 𝑠, 𝑡. According to these findings, the chromatic number, or
χ(𝐺), is three. This means that three different colors are enough to color the map so that no two
nearby locations have the same color. This result is consistent with the four-color theorem, which
states that a planar graph can only have four colors. The acquired coloring ensures that adjacent
sections have unique colors, proving the greedy algorithm's effectiveness in addressing this
problem for a planar graph with 22 regions. These findings enable the original map to be
suitably colored with the three identified colors, thus providing visual evidence of the algorithm's
efficacy. This accurate coloring of the map demonstrates the algorithm's usefulness in obtaining
an ideal and effective solution in addition to validating the algorithm.
Applying the greedy algorithm to the map coloring problem gave us the following vertex colors:
Green for nodes𝑏, 𝑑, 𝑔, 𝑖, 𝑚, 𝑟 and 𝑢; Blue for nodes 𝑒, 𝑘, 𝑛, 𝑣; and Pink for nodes
𝑎, 𝑐, 𝑓, ℎ, 𝑗, 𝑙, 𝑜, 𝑝, 𝑞, 𝑠, 𝑡. This shows that the chromatic number, χ(𝐺), is three, meaning we
only need three colors to ensure no two adjacent regions share the same color. This coloring
proves the algorithm's effectiveness for a planar graph with 22 regions. Using Euler's formula
(𝑉 − 𝐸 + 𝐹) = 2, we can verify the properties of the original and dual graphs. In the original
graph, vertices represent regions, and edges represent shared boundaries. In the dual graph, each
face in the original graph becomes a vertex, ensuring planarity.
These results allow us to color the original map accurately with the three identified colors,
visually confirming the algorithm's success. This proper coloring validates the algorithm and
demonstrates its practical application in solving map coloring problems efficiently and optimally.
The equation (𝑉 − 𝐸 + 𝐹) = 2
Data original:
22 − 42 + 22 = 2
Dual Graph:
22 − 42 + 22 = 2
In conclusion, we have successfully verified the validity of the four color theorem by
demonstrating our ability to color the selected planar graph using a minimum of three colors
(chromatic number = 3), while ensuring that no two neighboring vertices have the same color for
graph coloring. The same principle applies to vertex coloring, where we ensure that no
consecutive vertices share the same color. Using the greedy technique to color maps is effective
and economical. We found that the chromatic number, 𝜒(𝐺), is three by assigning colors to each
node. This suggests that just three colors are needed to prevent nearby faces from sharing colors.
The 22-region planar graph coloring proves the algorithm's viability. We tested the characteristics
of the original and dual graphs using Euler's formula (V - E + F = 2), confirming our approach's
planarity and accuracy. In summary, the greedy algorithm solved the map coloring issue
optimally, demonstrating its real-world implications.
5.0 REFERENCES
(Autonomous), Ernakulam).
Arifin, S., Muktyas, I. B., Maki, W. F. A., & Aziz, M. K. B. M. (2022). Graph Coloring program
of exam scheduling modeling based on bitwise coloring algorithm using Python. Journal
https://doi.org/10.3844/jcssp.2022.26.32
Burke, E. K., Mareček, J., Parkes, A. J., & Rudová, H. (2010). A supernodal formulation of
179, 105-130.
Cho, E. K., Choi, I., Kwon, H., & Park, B. (2022). Proper conflict-free coloring of sparse graphs.
Ganguli, R., & Roy, S. (2017). A study on course timetable scheduling using graph coloring
469-485.
Guo, T., & Tang, Z. (2023). A proof of Four-Color theorem. Journal of Applied Mathematics and
Havet, F. (2007). Graph colouring and applications. Habilitationa diriger des recherches,
Idris, A., Ismail, B., Jama’are, M. U., & Zaharaddeen, D. (2018). Vertex Colorings of Graph and
https://www.sciencepublishinggroup.com/article/10.11648/j.mlr.20180302.13
Intro. (2003). Science, 302(5652), 1871e1871. https://doi.org/10.1126/science.302.5652.1871e
Pickard, J. (2022, February 12). Graph Theory: Euler’s Formula for Planar Graphs - Math
https://medium.com/math-simplified/graph-theory-eulers-theorem-for-planar-graphs-207
6bbdb59be