SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Presented By : Subhradeep Mitra
Ankita Dutta
Debanjana Biswas
(Student of mca rajabazar sc college)
Contents
• Graph-coloring using Intelligent Backtracking
• Graph-coloring
• Hamiltonian-cycle
• Subset-sum problem
• N-Queen problem
• Backtracking
• Conclusion
BACKTRACKING
The principle idea of back-tracking is to
construct solutions as component at a time.
And then evaluate such partially
constructed solutions.
Backtracking [animation]
start ?
?
dead end
dead end
?
?
dead end
dead end
?
success!
dead end
Key Terms:
• State-space tree
• Root
• Components
• Promising & Non-promising
• Leaves
N-Queen Problem
Problem:- The problem is to place n queens on an
n-by-n chessboard so that no two
queens attack each other by being in
the same row, or in the same column, or
in the same diagonal.
Observation:- Case 1 : n=1
Case 2 : n=2
Case 3 : n=3
Case 4 : n=4
• Case 4: For example to explain the n-
Queen problem we Consider n=4 using a 4-
by-4 chessboard where 4-Queens have to be
placed in such a way so that no two queen
can attack each other.
4
3
2
1
4321
Q
Q
Q
Q
Q
Q
Q
Q
Q
Q
Q
Q
Q
Q
Q
Q
Q
Q
2
1
3
5
6
4
0
7
8
x x
xxx
x x
x
xxxx
xx
xxx
Q
Q
Q
Q
Queen-1
Queen-2
Queen-3
Queen-44
3
2
1
4321
Board for the four-queens problemFigure:-
• Using this above mechanism we can obtain two
solutions shown in the two consecutive figures:-
Q
Q
Q
Q
Queen-1
Queen-2
Queen-3
Queen-44
3
2
1
4321
Board for the four-queens problemFigure:-
• Subset-sum Problem: The problem is to find a subset of a given set
S = {s1, s2,- - -, sn} of ‘n’ positive integers
whose sum is equal to a given positive integer
‘d’.
• Example : For S = {3, 5, 6, 7} and d = 15, the solution is
shown below :-
Solution = {3, 5, 7}
Subset-sum Problem
• Observation : It is convenient to sort the set’s elements in
increasing order, S1 ≤ S2 ≤ ….. ≤ Sn. And each
set of solutions don’t need to be necessarily of
fixed size.
15 8
511
05
814 3
8
9
3
0
3
0
with 6
with 5
with 6
with 7
with 6
with 5
with 3
w/o 5
w/o 6
w/o 5
w/o 3
w/o 6
w/o 7
w/o 6
solution
14+7>15 3+7<159+7>15 11+7>15
0+6+7<15
5+7<15
8<15
7
0
3
5
6
Figure : Compete state-space tree of the backtracking algorithm applied to the instance S =
{3, 5, 6, 7} and d = 15 of the subset-sum problem. The number inside a node is the
sum of the elements already included in subsets represented by the node. The
inequality below a leaf indicates the reason for its termination.
x
xx xxx
x
This problem is concern about finding a
Hamiltonian circuit in a given graph.
Problem:
Hamiltonian Circuit Problem
Hamiltonian circuit is defined as a cycle
that passes to all the vertices of the
graph exactly once except the starting
and ending vertices that is the same
vertex.
Hamiltonian
circuit:
Figure: • (a) Graph.
• (b) State-space tree for finding a Hamiltonian circuit. The
numbers above the nodes of the tree indicate the order the order
in which nodes are generated.
For example consider the given graph
and evaluate the mechanism:-
(a)
(b)
Coloring a map
Problem:
Let G be a graph and m be a given positive integer. We want to
discover whether the nodes of G can be colored in such a way that
no two adjacent node have the same color yet only m colors are
used. This technique is broadly used in “map-coloring”; Four-color
map is the main objective.
Consider the following map and it can be easily decomposed
into the following planner graph beside it :
This map-coloring problem of the given map
can be solved from the planner graph, using
the mechanism of backtracking. The state-
space tree for this above map is shown below:
Four colors are chosen as
- Red, Green, Blue and
Yellow
Now the map can be
colored as shown here:-
(a) The principal states and territories of Australia. Coloring this map can
be viewed as a constraint satisfaction problem (CSP). The goal is to assign colors
to each region so that no neighboring regions have the same color. (b) The map-
coloring problem represented as a constraint graph.
Figure:
Artificial Intelligence
Constraints: C = {SA WA, SA NT, SA Q, SA NSW, SA V, WA NT,
NT Q, Q NSW , NSW V}
domain of each variable Di = {red, green, blue}
We are given the task of coloring each region either red,
green, or blue in such a way that no neighboring regions have
the same color. To formulate this as a CSP the following
assumptions are made:
Problem:
regions as, X = {WA, NT ,Q, NSW ,V,SA,T}
Observation:-
• Once we have chosen {SA = blue}, none of the five neighboring
variables can take on the value blue. So we have only 25 = 32
assignments to look at instead of 35= 243 assignments for the five
neighboring variables.
• Furthermore, we can see why the assignment is not a solution—we
see which variables violate a constraint—so we can focus attention
on the variables that matter.
Now the map can be colored as shown here:-
Conclusion
In conclusion, three things on behalf of backtracking need
to be said:-
• It is typically applied to difficult combinatorial problems
for which no efficient algorithm for finding, exact solutions
possibly exist.
• Backtracking solves each instances of a problem in an
acceptable amount of time.
• It generates all elements of the problem state.
Reference: Books:
• Anany Levitin Design and Analysis of
Algorithms (page 394-405)
• Computer Algorithms Horowitz and Sahani
(page 380-393)
•http://www.2shared.com/document/W1dBNI
GP/Stuart_Russell_and_Peter_Norvi.html
Thank You

Weitere ähnliche Inhalte

Was ist angesagt?

Recursion tree method
Recursion tree methodRecursion tree method
Recursion tree methodRajendran
 
N queens using backtracking
N queens using backtrackingN queens using backtracking
N queens using backtrackingsrilekhagourishetty
 
Backtracking Algorithm.ppt
Backtracking Algorithm.pptBacktracking Algorithm.ppt
Backtracking Algorithm.pptSalmIbrahimIlyas
 
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycleBacktracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cyclevarun arora
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy methodhodcsencet
 
01 knapsack using backtracking
01 knapsack using backtracking01 knapsack using backtracking
01 knapsack using backtrackingmandlapure
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesFahim Ferdous
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithmsRajendran
 
Back tracking and branch and bound class 20
Back tracking and branch and bound class 20Back tracking and branch and bound class 20
Back tracking and branch and bound class 20Kumar
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithmssandeep54552
 
Merge sort algorithm
Merge sort algorithmMerge sort algorithm
Merge sort algorithmShubham Dwivedi
 
5.1 greedy
5.1 greedy5.1 greedy
5.1 greedyKrish_ver2
 
Introduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of OptimalityIntroduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of OptimalityBhavin Darji
 
8 queen problem
8 queen problem8 queen problem
8 queen problemNagajothiN1
 
Lecture optimal binary search tree
Lecture optimal binary search tree Lecture optimal binary search tree
Lecture optimal binary search tree Divya Ks
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1Amrinder Arora
 
String matching algorithms
String matching algorithmsString matching algorithms
String matching algorithmsAshikapokiya12345
 

Was ist angesagt? (20)

Recursion tree method
Recursion tree methodRecursion tree method
Recursion tree method
 
N queens using backtracking
N queens using backtrackingN queens using backtracking
N queens using backtracking
 
Backtracking Algorithm.ppt
Backtracking Algorithm.pptBacktracking Algorithm.ppt
Backtracking Algorithm.ppt
 
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycleBacktracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
 
01 knapsack using backtracking
01 knapsack using backtracking01 knapsack using backtracking
01 knapsack using backtracking
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and Examples
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
 
Back tracking and branch and bound class 20
Back tracking and branch and bound class 20Back tracking and branch and bound class 20
Back tracking and branch and bound class 20
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
 
Merge sort algorithm
Merge sort algorithmMerge sort algorithm
Merge sort algorithm
 
5.1 greedy
5.1 greedy5.1 greedy
5.1 greedy
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
 
Introduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of OptimalityIntroduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of Optimality
 
8 queen problem
8 queen problem8 queen problem
8 queen problem
 
Backtracking
BacktrackingBacktracking
Backtracking
 
Lecture optimal binary search tree
Lecture optimal binary search tree Lecture optimal binary search tree
Lecture optimal binary search tree
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1
 
String matching algorithms
String matching algorithmsString matching algorithms
String matching algorithms
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Greedy algorithm
 

Ähnlich wie Graph Coloring and Backtracking Algorithms Explained

bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptxbcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptxB.T.L.I.T
 
Algorithm Performance For Chessboard Separation Problems
Algorithm Performance For Chessboard Separation ProblemsAlgorithm Performance For Chessboard Separation Problems
Algorithm Performance For Chessboard Separation ProblemsTina Gabel
 
Graphs in Data Structure
 Graphs in Data Structure Graphs in Data Structure
Graphs in Data Structurehafsa komal
 
MODULE_05-Matrix Decomposition.pptx
MODULE_05-Matrix Decomposition.pptxMODULE_05-Matrix Decomposition.pptx
MODULE_05-Matrix Decomposition.pptxAlokSingh205089
 
Stochastic Process Exam Help
Stochastic Process Exam HelpStochastic Process Exam Help
Stochastic Process Exam HelpStatistics Exam Help
 
Lego like spheres and tori, enumeration and drawings
Lego like spheres and tori, enumeration and drawingsLego like spheres and tori, enumeration and drawings
Lego like spheres and tori, enumeration and drawingsMathieu Dutour Sikiric
 
Undecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation AlgorithmsUndecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation AlgorithmsMuthu Vinayagam
 
Lecture 7 (inequalities)
Lecture 7 (inequalities)Lecture 7 (inequalities)
Lecture 7 (inequalities)HarithaRanasinghe
 
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWERUndecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWERmuthukrishnavinayaga
 
Color Coding-Related Techniques
Color Coding-Related TechniquesColor Coding-Related Techniques
Color Coding-Related Techniquescseiitgn
 
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph ColouringGraph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph ColouringSaurabh Kaushik
 
Digital control systems (dcs) lecture 18-19-20
Digital control systems (dcs) lecture 18-19-20Digital control systems (dcs) lecture 18-19-20
Digital control systems (dcs) lecture 18-19-20Ali Rind
 
Taller de Geometria
Taller de GeometriaTaller de Geometria
Taller de GeometriaSuly Vitonas
 
Maths Revision Notes - IGCSE
Maths Revision Notes - IGCSEMaths Revision Notes - IGCSE
Maths Revision Notes - IGCSERahul Jose
 
Data Analysis and Algorithms Lecture 1: Introduction
 Data Analysis and Algorithms Lecture 1: Introduction Data Analysis and Algorithms Lecture 1: Introduction
Data Analysis and Algorithms Lecture 1: IntroductionTayyabSattar5
 

Ähnlich wie Graph Coloring and Backtracking Algorithms Explained (20)

bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptxbcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
bcfbedbf-6679-4d5d-b8a5-7d4c9c48dba4.pptx
 
Algorithm Performance For Chessboard Separation Problems
Algorithm Performance For Chessboard Separation ProblemsAlgorithm Performance For Chessboard Separation Problems
Algorithm Performance For Chessboard Separation Problems
 
Graphs in Data Structure
 Graphs in Data Structure Graphs in Data Structure
Graphs in Data Structure
 
Math1
Math1Math1
Math1
 
MODULE_05-Matrix Decomposition.pptx
MODULE_05-Matrix Decomposition.pptxMODULE_05-Matrix Decomposition.pptx
MODULE_05-Matrix Decomposition.pptx
 
Stochastic Process Exam Help
Stochastic Process Exam HelpStochastic Process Exam Help
Stochastic Process Exam Help
 
Stochastic Process Assignment Help
Stochastic Process Assignment HelpStochastic Process Assignment Help
Stochastic Process Assignment Help
 
Lego like spheres and tori, enumeration and drawings
Lego like spheres and tori, enumeration and drawingsLego like spheres and tori, enumeration and drawings
Lego like spheres and tori, enumeration and drawings
 
Undecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation AlgorithmsUndecidable Problems and Approximation Algorithms
Undecidable Problems and Approximation Algorithms
 
Lecture 7 (inequalities)
Lecture 7 (inequalities)Lecture 7 (inequalities)
Lecture 7 (inequalities)
 
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWERUndecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
Undecidable Problems - COPING WITH THE LIMITATIONS OF ALGORITHM POWER
 
Ca 1.6
Ca 1.6Ca 1.6
Ca 1.6
 
Color Coding-Related Techniques
Color Coding-Related TechniquesColor Coding-Related Techniques
Color Coding-Related Techniques
 
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph ColouringGraph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
 
Digital control systems (dcs) lecture 18-19-20
Digital control systems (dcs) lecture 18-19-20Digital control systems (dcs) lecture 18-19-20
Digital control systems (dcs) lecture 18-19-20
 
Taller de Geometria
Taller de GeometriaTaller de Geometria
Taller de Geometria
 
Maths Revision Notes - IGCSE
Maths Revision Notes - IGCSEMaths Revision Notes - IGCSE
Maths Revision Notes - IGCSE
 
Data Analysis and Algorithms Lecture 1: Introduction
 Data Analysis and Algorithms Lecture 1: Introduction Data Analysis and Algorithms Lecture 1: Introduction
Data Analysis and Algorithms Lecture 1: Introduction
 
Unit ix graph
Unit   ix    graph Unit   ix    graph
Unit ix graph
 
Stochastic Processes Homework Help
Stochastic Processes Homework Help Stochastic Processes Homework Help
Stochastic Processes Homework Help
 

Mehr von subhradeep mitra

Different Transmission Media
Different Transmission MediaDifferent Transmission Media
Different Transmission Mediasubhradeep mitra
 
Generation Of Computer
Generation Of ComputerGeneration Of Computer
Generation Of Computersubhradeep mitra
 
GLOBAL INSURANCE PVT LTD.
GLOBAL INSURANCE PVT LTD.GLOBAL INSURANCE PVT LTD.
GLOBAL INSURANCE PVT LTD.subhradeep mitra
 
Wireless body area network
Wireless body area network Wireless body area network
Wireless body area network subhradeep mitra
 
Wireless Body Area Networking
Wireless Body Area NetworkingWireless Body Area Networking
Wireless Body Area Networkingsubhradeep mitra
 
Different types of Symmetric key Cryptography
Different types of Symmetric key CryptographyDifferent types of Symmetric key Cryptography
Different types of Symmetric key Cryptographysubhradeep mitra
 
Automatic temperature control using 8085 microprocessor
Automatic temperature control using 8085 microprocessorAutomatic temperature control using 8085 microprocessor
Automatic temperature control using 8085 microprocessorsubhradeep mitra
 
crosstalk minimisation using vlsi
crosstalk minimisation using vlsicrosstalk minimisation using vlsi
crosstalk minimisation using vlsisubhradeep mitra
 

Mehr von subhradeep mitra (12)

INTERNET TECHNOLOGY
INTERNET  TECHNOLOGYINTERNET  TECHNOLOGY
INTERNET TECHNOLOGY
 
Different Transmission Media
Different Transmission MediaDifferent Transmission Media
Different Transmission Media
 
Fifa world cup
Fifa world cupFifa world cup
Fifa world cup
 
West bengal-tourism
West bengal-tourismWest bengal-tourism
West bengal-tourism
 
Generation Of Computer
Generation Of ComputerGeneration Of Computer
Generation Of Computer
 
Students Profile
Students ProfileStudents Profile
Students Profile
 
GLOBAL INSURANCE PVT LTD.
GLOBAL INSURANCE PVT LTD.GLOBAL INSURANCE PVT LTD.
GLOBAL INSURANCE PVT LTD.
 
Wireless body area network
Wireless body area network Wireless body area network
Wireless body area network
 
Wireless Body Area Networking
Wireless Body Area NetworkingWireless Body Area Networking
Wireless Body Area Networking
 
Different types of Symmetric key Cryptography
Different types of Symmetric key CryptographyDifferent types of Symmetric key Cryptography
Different types of Symmetric key Cryptography
 
Automatic temperature control using 8085 microprocessor
Automatic temperature control using 8085 microprocessorAutomatic temperature control using 8085 microprocessor
Automatic temperature control using 8085 microprocessor
 
crosstalk minimisation using vlsi
crosstalk minimisation using vlsicrosstalk minimisation using vlsi
crosstalk minimisation using vlsi
 

KĂźrzlich hochgeladen

Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 

KĂźrzlich hochgeladen (20)

Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 

Graph Coloring and Backtracking Algorithms Explained

  • 1. Presented By : Subhradeep Mitra Ankita Dutta Debanjana Biswas (Student of mca rajabazar sc college)
  • 2. Contents • Graph-coloring using Intelligent Backtracking • Graph-coloring • Hamiltonian-cycle • Subset-sum problem • N-Queen problem • Backtracking • Conclusion
  • 3. BACKTRACKING The principle idea of back-tracking is to construct solutions as component at a time. And then evaluate such partially constructed solutions.
  • 4. Backtracking [animation] start ? ? dead end dead end ? ? dead end dead end ? success! dead end
  • 5. Key Terms: • State-space tree • Root • Components • Promising & Non-promising • Leaves
  • 6. N-Queen Problem Problem:- The problem is to place n queens on an n-by-n chessboard so that no two queens attack each other by being in the same row, or in the same column, or in the same diagonal. Observation:- Case 1 : n=1 Case 2 : n=2 Case 3 : n=3 Case 4 : n=4
  • 7. • Case 4: For example to explain the n- Queen problem we Consider n=4 using a 4- by-4 chessboard where 4-Queens have to be placed in such a way so that no two queen can attack each other. 4 3 2 1 4321
  • 9. Q Q Q Q Queen-1 Queen-2 Queen-3 Queen-44 3 2 1 4321 Board for the four-queens problemFigure:- • Using this above mechanism we can obtain two solutions shown in the two consecutive figures:-
  • 11. • Subset-sum Problem: The problem is to find a subset of a given set S = {s1, s2,- - -, sn} of ‘n’ positive integers whose sum is equal to a given positive integer ‘d’. • Example : For S = {3, 5, 6, 7} and d = 15, the solution is shown below :- Solution = {3, 5, 7} Subset-sum Problem • Observation : It is convenient to sort the set’s elements in increasing order, S1 ≤ S2 ≤ ….. ≤ Sn. And each set of solutions don’t need to be necessarily of fixed size.
  • 12. 15 8 511 05 814 3 8 9 3 0 3 0 with 6 with 5 with 6 with 7 with 6 with 5 with 3 w/o 5 w/o 6 w/o 5 w/o 3 w/o 6 w/o 7 w/o 6 solution 14+7>15 3+7<159+7>15 11+7>15 0+6+7<15 5+7<15 8<15 7 0 3 5 6 Figure : Compete state-space tree of the backtracking algorithm applied to the instance S = {3, 5, 6, 7} and d = 15 of the subset-sum problem. The number inside a node is the sum of the elements already included in subsets represented by the node. The inequality below a leaf indicates the reason for its termination. x xx xxx x
  • 13. This problem is concern about finding a Hamiltonian circuit in a given graph. Problem: Hamiltonian Circuit Problem Hamiltonian circuit is defined as a cycle that passes to all the vertices of the graph exactly once except the starting and ending vertices that is the same vertex. Hamiltonian circuit:
  • 14. Figure: • (a) Graph. • (b) State-space tree for finding a Hamiltonian circuit. The numbers above the nodes of the tree indicate the order the order in which nodes are generated. For example consider the given graph and evaluate the mechanism:- (a) (b)
  • 15. Coloring a map Problem: Let G be a graph and m be a given positive integer. We want to discover whether the nodes of G can be colored in such a way that no two adjacent node have the same color yet only m colors are used. This technique is broadly used in “map-coloring”; Four-color map is the main objective. Consider the following map and it can be easily decomposed into the following planner graph beside it :
  • 16. This map-coloring problem of the given map can be solved from the planner graph, using the mechanism of backtracking. The state- space tree for this above map is shown below:
  • 17. Four colors are chosen as - Red, Green, Blue and Yellow Now the map can be colored as shown here:-
  • 18. (a) The principal states and territories of Australia. Coloring this map can be viewed as a constraint satisfaction problem (CSP). The goal is to assign colors to each region so that no neighboring regions have the same color. (b) The map- coloring problem represented as a constraint graph. Figure: Artificial Intelligence
  • 19. Constraints: C = {SA WA, SA NT, SA Q, SA NSW, SA V, WA NT, NT Q, Q NSW , NSW V} domain of each variable Di = {red, green, blue} We are given the task of coloring each region either red, green, or blue in such a way that no neighboring regions have the same color. To formulate this as a CSP the following assumptions are made: Problem: regions as, X = {WA, NT ,Q, NSW ,V,SA,T}
  • 20. Observation:- • Once we have chosen {SA = blue}, none of the five neighboring variables can take on the value blue. So we have only 25 = 32 assignments to look at instead of 35= 243 assignments for the five neighboring variables. • Furthermore, we can see why the assignment is not a solution—we see which variables violate a constraint—so we can focus attention on the variables that matter.
  • 21. Now the map can be colored as shown here:-
  • 22. Conclusion In conclusion, three things on behalf of backtracking need to be said:- • It is typically applied to difficult combinatorial problems for which no efficient algorithm for finding, exact solutions possibly exist. • Backtracking solves each instances of a problem in an acceptable amount of time. • It generates all elements of the problem state.
  • 23. Reference: Books: • Anany Levitin Design and Analysis of Algorithms (page 394-405) • Computer Algorithms Horowitz and Sahani (page 380-393) •http://www.2shared.com/document/W1dBNI GP/Stuart_Russell_and_Peter_Norvi.html