Documente Academic
Documente Profesional
Documente Cultură
Dr Christopher Hampson
Department of Informatics
• What is the minimum number of colours required to colour the graph such
that no two adjacent vertices share are the same colour.
(note that the graph is not planar )
http://www.claymath.org/millennium-problems/p-vs-np-problem
by g(n).
f (n) = O(g(n))
or
f (n) ∈ O(g(n)) n
2n
n3 n2
logn
√
O(1) ( O(logn) ( O( n) ( O(n) ( O(n2 ) ( O(n3 ) ( . . . ( O(2n )
Example
r
n
T (n) = 527 + n4 sin(n) + log2018 (6n) + 999! = O(n4 )
π
(i) M accepts X,
• The complexity class P is the class of all problems that are decidable
in polynomial time
P =
all problems decidable in polynomial time
all problems decidable in
NP =
non-deterministic polynomial time
Problems that belong to NP are those for which we can verify the
solution in polynomial time — you only need to show me a single
computation that accepts the input. However, to find the solution
may require an exhaustive search of all possible computations.
(i) M accepts X,
• The complexity class P is the class of all problems that are decidable
in polynomial time
PSpace =
all problems decidable in polynomial space
P = NP NP ⊆ PSpace P = coP
P ⊆ NP P = NP ∩ coNP NP ⊆ coNP
PSpace
NP co-NP
NP ∩ co-NP
P Q R (P ∨ ¬R) → ¬(¬Q ∨ R)
True True True False
True True False True
True False True False
True False False False
False True True True
Satisfiable False True False True
so output True False False True True
False False False False
(i.e. there is a non-deterministic algorithm for SAT that runs in polynomial time)
Proof:
Q . E . D.
5CCS2FC2: Foundations of Computing II C.Hampson, King’s College London 16 / 34
The Clique Problem
Has clique of
size 4
Proof:
Q . E . D.
5CCS2FC2: Foundations of Computing II C.Hampson, King’s College London 18 / 34
Polynomial Reductions
(Some Examples)
• Polynomial Reduction
w∈A ⇐⇒ f (w) ∈ B
Colours
G = {B, G, R}
Proof:
Step 3) We can write down a set of formulas FG that say that the graph can
be coloured with only colours from C,
Pv,B ∨ Pv,G ∨ Pv,R for all v ∈ V
¬ Pv,B ∧ Pv,G ∧ ¬ Pv,B ∧ Pv,R ∧ ¬ Pv,G ∧ Pv,R for all v ∈ V
¬ Pv,B ∧ Pu,B ∧ ¬ Pv,G ∧ Pu,G ∧ ¬ Pv,R ∧ Pv,R for all (u, v) ∈ E
Step 3) This set of formulas FG is satisfiable if and only if the graph G can be
coloured with k colours
G ∈ COLOURING ⇐⇒ FG ∈ SAT
Q . E . D.
Obv 1) Any clique of size k must contain a literal from each clause
(since literals in the same clause are not connected with an edge)
(since literals and their negations are not connected with an edge)
Q . E . D.
Clause 1
P ¬Q R
¬P P
¬Q Q
C
3
la
e
us
us
la
e
C
2
¬R ¬R
• NP-hardness
Y ≤p X for all Y ∈ X
• NP-completeness
Proof:
Z ≤p Y ≤p X for all Z ∈ NP
Q . E . D.
https://en.wikipedia.org/wiki/List_of_NP-complete_problems
• Lemmings
• Pokémon
Et cetera, et cetera...
https://en.wikipedia.org/wiki/List_of_NP-complete_problems
https://goo.gl/forms/xKCooYMGmuyhBjvx1