0% found this document useful (0 votes)
39 views19 pages

Lecture 8

The lecture discusses the Greedy Algorithm and its limitations in coloring graphs, highlighting that the number of colors used can depend on the order of vertex processing. It introduces the Welsh Powell Algorithm as a method to optimize vertex coloring by sorting vertices based on their degree. The document also includes exercises related to scheduling and coloring problems in practical scenarios, such as committee meetings and exam schedules.

Uploaded by

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

Lecture 8

The lecture discusses the Greedy Algorithm and its limitations in coloring graphs, highlighting that the number of colors used can depend on the order of vertex processing. It introduces the Welsh Powell Algorithm as a method to optimize vertex coloring by sorting vertices based on their degree. The document also includes exercises related to scheduling and coloring problems in practical scenarios, such as committee meetings and exam schedules.

Uploaded by

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

06/15/2025

Graph Theory
Lecture - 8

Dr. Ilyas Fakhir


06/15/2025
Analysis of Greedy Algorithm
• TheGreedy Algorithm doesn’t always use minimum
number of colors. Also, the number of colors used
sometime depend on the order in which vertices are
processed.
Example

06/15/2025
• For example, consider the two graphs on next slide.
Note that in graph on right side, vertices 3, and 4 are
swapped. If we consider the vertices 0, 1, 2, 3, 4 in
left graph, we can color the graph using 3 colors. But if
we consider the vertices 0, 1, 2, 3, 4 in right graph, we
need 4 colors.
06/15/2025
Analysis of Greedy Algorithm
06/15/2025
Welsh Powell Algorithm
• Find the degree of each vertex .
• List the vertices in order of descending valence i.e.
Valence degree(v(i)) >= degree(v(i+1)) .
• Color the first vertex in the list.
• Go down the sorted list and color every vertex not
connected to the colored vertices above the same color
then cross out all colored vertices in the list.
• Repeat the process on the uncolored vertices with a
new color-always working in descending order of degree
until all in descending order of degree until all vertices
are colored.
06/15/2025
Welsh Powell Algorithm Example
06/15/2025
Example
• The new order will be: H, K, D, G, I, J, A, B, E, F, C
• Now Color the vertices:
06/15/2025
Example
• Ignore the colored vertices, so new order: K, G, I, J, A, B,
F, C
• Repeat the process for new color:
06/15/2025
Example
• Again ignore the colored vertices, so new order: G, J, B
• Repeat the process for new color:
06/15/2025
Exercise
• Twelve faculty members in a informatics department serve on
the following committees:ƒ
 Undergraduate Education: Sineman, Limitson, Axiomus,
Functioniniƒ
 Graduate Education: Graphian, Vectorades, Functionini,
Infinitescuƒ
 Colloquium: Lemmeau, Randomov, Proofizaki
 ƒLibrary: Van Sum, Sineman, Lemmeauƒ
 Staffing: Graphian, Randomov, Vectorades, Limitsonƒ
 Promotion: Vectorades, Van Sum, Parabolton
• The committees must all meet during the first week of
classes, but there are only three time slots available. Find a
schedule that will allow all faculty members to attend the
meetings of all committees on which they serve.
Example

06/15/2025
• Suppose that in one particular semester, there are
students taking each of the following combinations of
courses.
* Mathematics, English, Biology, Chemistry
* Mathematics, English, Computer Science, Geography
* Biology, Psychology, Geography, Spanish
* Biology, Computer Science, History, French
* English, Psychology, History, Computer Science
* Psychology, Chemistry, Computer Science, French
* Psychology, Geography, History, Spanish.
What is the minimum number of examination periods
required for exams in the ten courses specified so that
students taking any of the given combinations of courses
have no conflicts ?
Find a possible schedule which uses this minimum number
06/15/2025
Example
• How can the final exams at a university be scheduled so
that no student has two exams at the same time ?
• Forinstance, suppose there are seven finals to be
scheduled. Suppose the courses are numbered 1 through
7. Suppose that the following pairs of courses have
common students : 1 and 2, 1 and 3, 1 and 4, 1 and 7, 2
and 3, 2 and 4, 2 and 5, 2 and 7, 3 and 4, 3 and 6, 3 and
7, 4 and 5, 4 and 6, 5 and 6, 5 and 7, and 6 and 7.
06/15/2025
Example

06/15/2025
• Find the chromatic numbers of the graphs below.

14
Example

06/15/2025
• Find the chromatic numbers of the graphs below.

15
Example

06/15/2025
• Suppose that you are responsible for scheduling times for
lectures in a university. You want to make sure that any
two lectures with a common student occur at different
times to avoid a conflict.

16
06/15/2025
Here is a 4-coloring of the graph by Greedy Algorithm:
Example

06/15/2025
• Coloring Map.

18
06/15/2025
19

You might also like