-Konigsberg
z:
Feb .
4th
Bridge
Problem
Thursday ,
x •
.
‘
Question :
some vertex , use each edge
once , and return to start vertex.
we we
allow allow
start at exactly
multi – self –
edges
loops
Definitional
EXdm X
:
Awalkis a listno,e,
in
. . ,e,
¥
ez W e, Z , Ey w setit, es, X ,,,, ,
W
, .
e,
x •
. 2-
Definition ( trail) A trail is
txt:
e
,
walk
with
no
repeated
edge
x .
X,
W
,
€’e same;
y
ez .
X ,,
eo ,
y
w•.
walk ) )
A trail is closed if endpoints are
Definitionclosed
traitor
A
” walk
Definition ( A graph
that
Definition ( circuit)
A closed trail
i f
Eulerian graph )
it all
trail
i s
Eulerian contains
has closed the edges.
first vertex
order ) \
247 11
24 I,
where the list
don’t specify
( Eulerian
specify
circuit )
i n
cyclic
w e
I
Definition
An
is
1
( Eulerian
graph
circuit containing all the edges.
circu it
in a
7 247I
-Eulerian
5 vertices
–
circuit Ks
Example complete
graph
with
÷Is.
W
V,W, X,y, 2-,V,X,Z,W,y,V
V
-tr-ivial component Bo
:
a connected
component
with
no
edges
theorem ( characterization
graphs)
o f
A graph G is Eulerian it and only if
Eulerian
”
[ it there d
is at most one nontrivial Iiit all vertices have even degree
i
component
lemmdCHas-d-c.ie/eLemm#
let Then
G
be G
a graph contains
where all vertices have degree 2 2 cycle .
a
not
a
path
Prout: Take
.tl.
Since Since
a
maximal path P with one .•u-•N-q-•
endpoint u .
I
cycle
path is degree
maximal
vertex
has another
o f
, a n y u22,
u
neighbor
adjacent to u
must be in v in
P P.
h⇐roufoftheorem
G has Eulerian circuit
,
if
Lil G has at most one
)
then
n o n –
trivial
component
:* :p r
ciil All vertices must have even degree.
.
use
each
edge
exactly
once
.
we use 2 edges
incident t o * ertex .
Suppose Each
C is time C
Eulerian
circuit. passes through vertex ,
.
( Proof #
.
H degree
G has at most 1 nontrivial component ,
Assume
and all vertices have even
of
✓
Proof Base
I.H
.
by case
induction # on
!M=O
edges •
m.
holds (i.e. if # edges a m .
circuit)
I
J
claim
has m
Eulerian
strong
I.
:
Assume
G
s
we prove that
if
edges
,
then
E !
.
.
holds (i.e. # edges
circuit)
I.H
.
We prove that
claim : H ( why ?
claim
Eulerian am
I .
strong
:
Assume
i f
I.
:
6
has a
b/c H is
if
connected ,
has m cycle
edges
I ,
Eulerian circuit .
then C
S Proof
.
and all vertices have even degree ,
til
se lf- loop
‘
and
Has –
lemma) contribute
d-
cycle
t.eu÷÷:÷i÷÷÷÷Ed
‘ .-
-r
Proof of
:
claim : Form
H
has a
cycle
C
.
. ‘M
has
Eulerian
Hedge belong to C
‘ G
edges
C
.
by G’
deleting with
in
: every component of G ‘ has all vertices
-each
↳
til
component of G ‘
has < m circuit .
even
degree
edges
.tH•:÷÷÷÷.÷i÷÷s:
se lf- loop
'
contribute
Form an
Eulerian
traverse cycle C and when a
circuit in G a s follows :
G
of ' forl
't
we
that
component
time
detour = follow Eulerian
take circuit
detour :
in
component .
ride
start
PM - 3 PM
Monday, Feb.
8th
:
1
time - end time
rides to taxi drivers
assign
if 2
rides overlap ←
need 2 different drivers
co
o_O
ride
--
vertex
VII.during
edge ⇐ rides
overlap
in time
o
O
-Definition :
K -
of graph
A K with
-
coloring ISI- K
G - -
is a distinct
coloring a
CV, El
labeling
f' .
v→s
The 1¥
.
elements coloring
are
colors .
k 3-
-Definition :
K -
of graph
coloring a
CV, El
labeling
f' .
v→s
A K
with
-
coloring ISI- K
G - -
is a distinct
A
K -
coloring
is propene
elements ¥O _O
are
colors .
.
The
k
if proper
have coloring
different
colors.
adjacent 1¥
vertices 3-
-Definition :
K -
of graph
A K
with
-
coloring ISI- k
G - -
is a distinct
coloring a
The
O_O Ao
CV, El
labeling
f' .
v→s
K - coloring
O_O Ao
A graph ¥-0
is propene
A
.
k
elements
are
colors .
if
adjacent
vertices
have
different
colors.
if it has a o_0 ←
K - this graph
coloring.
is
k -
colorable o4
proper
Is
3 -
colorable?
D-efinition
chromatic
number XCG )
the
is the
is
.
:
chromatic
number
Independent set in a Igraph
is a subset EV s. t
independent
E) V-u.ve
I
smallest G = CV,
k s't G k- colorable
.
.
, andV are
Kz, z
complete
bipartite
u
not adjacent .
-
graph
proper
K - coloring decomposes set of vertices into k independent sets
graphs⇐ bipartite graphs (are I
2-
colorable
-Theorem
if
( Konig , 1936) A graph is bipartite
and only
if it does
not have angddcycle.
with
edges
cycle odd #
-Theorem
if
1936) A graph is bipartite
-Lemma
closed odd
( Konig ,
(odd way,
and only
if it does
not have a n
odd cycle
.
walk y
odd
is odd cycle .
# edges in
Every
walk
contains
a n
-
XX÷.
teddy Proof: ( Induction
contains m in walk)
(self- loop)
odd
cycle .
Every
o n
closed
# edges
o.O
odd
walk
an
⇒ odd
I'
Basecase (m-it
cycle closed odd walk a - m
holds when
Prove claim holds when closed odd walk has m edges ,
claim I.s.
I. H.
Assume
# edges in
Ci) no repeated intermediate vertices (nor edges)
cases :
-#
ciil
⇒ already odd cycle I V
u vertex?
which
r.
be
do repeat some intermediate - form 2 closed walks
?.
w e
-
one
are closed
odd
joined a t walk must
froot
Base I. H.
I.s.
-#
o n
# edges case(m-it o.O
m in walk) (self- loop)
( Induction
⇒ odd
I'
Assume
claim
cycle closed odd walk a - m
holds when # edges in
Prove claim holds when closed odd walk has m edges ,
cases :
Ci) no repeated intermediate vertices (nor edges)
⇒ already odd cycle I V
u vertex?
which
- each closed walk e m edges .
ciil w e .
So
do repeat some intermediate - form 2 closed walks
-
one
be
are closed
r.
odd
joined a t walk must
from I.H.
,
the odd one ! has odd cycle
-Theorem
if
1936) A graph is bipartite
Proof: C
⇒
G be
( Konig ,
and only bipartite .
if
it
does
not have a n
odd cycle
.
let Claim :
no
odd
\cycle
all cycles
#✓←↳
be of length
::*:c :c
must even
!
(aw.
:c ni
they
would
-Theorem
if
1936) A graph is bipartite
C#
odd "
connected
( Konig ,
and only
if
it does
not have a n
odd cycle
.
Proof:
cycle
Claim : G .
i s bipartite
¥ bipartite ,
G
has no
.
Assume
if Suffices
components bipartite
all then
that
G prove
i s
to
H
is bipartite
# and let
( Proof
Teth be arbitrary
of u be arbitrary vertex in H .
G,
connected component
Since
let
H
is connected all vertices v in H I path from
-
Xeven he vertices s set of in H .t
.
,,"" "
min - length path from u to r is of even length (eveednge })
-
l e t "
Xodd
" 11
length
) ( oeddda.es#
this one
-
Claim : X Xodd
is
a n an
independent independent
"
set. set.
odd
←
we prove
even
is
Claim : froot
Xeven
is
indep. not !
set .
suppose
then I V.V'
I- t. odd
closed odd walk!
(from lemma , odd cycle!) y.
#eds"
even ohhhh)
rimming even
V is
to V'
in Xeven
adjacent .
ledge
' v
=
# edges
=
-Testing
colors
2 - colorability DFS :
at some vertex.
opposite£
use
(1) start
color each , of
,
vertex the opposite its predecessor
color
(2) using
D F S
edge has 2 endpoints with same color , then done
if no
(3)
C- "
(2-coloring found, n
else even
Carl and
/ / \) \
if
E flat -
,
f
y
proper
)/ odd cycle
path
#
ed " '
-
edge for cycle
I
even
t
t
more ⇒
-Definition
A Hamiltonian
/ #Ithat : Hamiltonian cycle a cycle
visits in the
a ll vertices
graph
cycle is a spanning cycle
.
•-
a
-Definition
#A Hamiltonian
/ a cycle v
cycle is a spanning cycle
:
Hamiltonian cycle
that a l l #y
visits
the graph
ertices
in
.
Definition
Hamiltonian A
: Hamiltonian
.
•-
graph is a graph that has a Hamiltonian cycle
a
r
-Definition
#A Hamiltonian
:
a
cycle a ll
visits
Hamiltonian cycle /
that vertices in the
cycle is a spanning cycle Hamiltonian
.
g
# →
graph
Definition A
: Hamiltonian
graph is a graph that has a Hamiltonian cycle
.
#Definition A
: Hamiltonian path
, path
a path #tIhat visits
all vertices in the graph
Hamiltonian
path i s
a
spanning
•-
.
a
-Decision
4)
(21 "
Thursday ,
Feb .
Nth
problems HAMILTONIAN
if otherwise
CYCLE
-
Return true and False
has Cycle
G Hami.l
" PATH -
true if G
Path
False otherwise
return
has
Hamil .
CD
and
CV are each
NP - -
w e don't
and complete
time algs! I
have polynomial
Suppose we have graph G = CV, E)
define
.
n e w
graph G
v
,
← ✓1
vertex Vo AT .L I//
complete
graph
k GK,
w/
one
"
start
with
and add edge
(V, Vo)
for
each ve V
if and
theorem
A
G r
G
has has
Hamil .
Hamil.
Path Cycle
if
:
graph
only
k ,
A
has
if
Vo
1/4 .[.J
CH. M
if and
theorem
:
graph
G
k , has
Hamil .
Path
only
G
r
Hamil. Cycle (Hic. )
p(⇒I-G suppose I H- P. i n
Hic in G v k,
±
C .
Claim
⇐
:I
.
Suppose
I H .
Gr
.
i n
claim: IHP. inb !
.
k
,
Vo If
E
4•I•⇒ Kit
Ky
is
a
planar
graph
Planar
graph
""
where we can
-
draw it
graph
sit.
"""
n o edges