Source code online books for professionals by professionals



Download 4,67 Mb.
Pdf ko'rish
bet178/266
Sana31.12.2021
Hajmi4,67 Mb.
#213682
1   ...   174   175   176   177   178   179   180   181   ...   266
Bog'liq
2 5296731884800181221

Figure 10-2.  An s-t network with one path found (heavy edges) and one augmenting path (highlighted)
The principle of canceling works just like in bipartite matching. As we search for an augmenting path, we move 
from s to a and then to b. There, we’re blocked by the edge bt. The problem at this point is that b has two incoming 
paths from a and c but only one outgoing path. By canceling the edge cb, we’ve solved the problem for b, but now 
there’s a problem at c. This is the same kind of cascade effect we saw for the bipartite matching. In this case, c has an 
incoming path from s, but no outgoing path—we need to find somewhere for the path to go. We do that by continuing 
our path via d to t, as shown by the highlights in Figure 
10-2
.
If you either add an incoming edge or cancel an outgoing one at some node u, that node will be overcrowded.  
It will have more paths entering than leaving, which isn’t allowed. You can fix this either by adding an outgoing edge 
or by canceling an incoming one. All in all, this works out to finding a path from s, following unused edges in their 
direction and used ones against their direction. Any time you can find such an augmenting path, you will also have 
discovered an additional disjoint path.
Listing 10-2 shows code for implementing this algorithm. As before, the code for the tr function can be found in 
Listing 5-10.


ChApTeR 10 

 MATChINgs, CuTs, ANd Flows 
214

Download 4,67 Mb.

Do'stlaringiz bilan baham:
1   ...   174   175   176   177   178   179   180   181   ...   266




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