Introduction to Algorithms, Third Edition



Download 4,84 Mb.
Pdf ko'rish
bet447/618
Sana07.04.2022
Hajmi4,84 Mb.
#534272
1   ...   443   444   445   446   447   448   449   450   ...   618
Bog'liq
Introduction-to-algorithms-3rd-edition

Figure 24.9
Showing that a simple path in
G
from source
s
to vertex
is unique. If there are two
paths
p
1
(
s
;
u
;
x
!
´
;
) and
p
2
(
s
;
u
;
y
!
´
;
), where
x
¤
y
, then
´: 
D
x
and
´: 
D
y
, a contradiction.
But
k
X
i
D
1
i
:
d
D
k
X
i
D
1
i
1
:
d
;
since each vertex in the cycle
c
appears exactly once in each summation. This
equality implies
0 >
k
X
i
D
1
w.
i
1

i
/ :
Thus, the sum of weights around the cycle
c
is negative, which provides the desired
contradiction.
We have now proven that
G
is a directed, acyclic graph. To show that it forms
a rooted tree with root
s
, it suffices (see Exercise B.5-2) to prove that for each
vertex
2
V
, there is a unique simple path from
s
to
in
G
.
We first must show that a path from
s
exists for each vertex in
V
. The ver-
tices in
V
are those with non-
NIL
values, plus
s
. The idea here is to prove by
induction that a path exists from
s
to all vertices in
V
. We leave the details as
Exercise 24.5-6.
To complete the proof of the lemma, we must now show that for any vertex
2
V
, the graph
G
contains at most one simple path from
s
to
. Suppose other-
wise. That is, suppose that, as Figure 24.9 illustrates,
G
contains two simple paths
from
s
to some vertex
:
p
1
, which we decompose into
s
;
u
;
x
!
´
;
,
and
p
2
, which we decompose into
s
;
u
;
y
!
´
;
, where
x
¤
y
(though
u
could be
s
and
´
could be
). But then,
´:
D
x
and
´:
D
y
, which implies
the contradiction that
x
D
y
. We conclude that
G
contains a unique simple path
from
s
to
, and thus
G
forms a rooted tree with root
s
.
We can now show that if, after we have performed a sequence of relaxation steps,
all vertices have been assigned their true shortest-path weights, then the predeces-
sor subgraph
G
is a shortest-paths tree.


676
Chapter 24
Single-Source Shortest Paths

Download 4,84 Mb.

Do'stlaringiz bilan baham:
1   ...   443   444   445   446   447   448   449   450   ...   618




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish