Ò ÓÛ ÆØÛÓÖ ÐÓÖØÑ ÓÖ¹ÙÐÖ ÓÒ
ÚÐÙÒ Øµ E µ ÙÚµ Ò Úµ µ E µ ÚÙµ ÐÐ ¹ÒÖ Ò ¹ÓÙØÖ Ó ÚÖØÜ Ú Î Ö Ö ÔØÚÐݺ ÄØ Î µ ÖØ ÖÔº ÓÖ ÚÖØÜ Ú Î Û Ò ÓÙØÖ Úµ Ò Ò Ø ÒÖ Ò Øµ Úµº ÓÖ Úµ Ø ÚÖØÜ Ú ÐÐ ÓÙÖ Úµ Á е ÓÖ Ò ÙÙµ Ó ÖÔ Ö ÔØÚÐݺ ÔØÝ Ó ÖÔ ÙÒØÓÒ Ê º ÕÙÒØØ Ì Úµ µ ÆØÛÓÖ ÚÖµ ÔÖ µ ÛÖ ÖØ ÖÔ Ò Ø ÔØݺ
Ì ÙÑ Ó ÐÐ ¹ÒÖ Ò ¹ÓÙØÖ ÈÖÓÔÓ ØÓÒº ÖÔ Ö ÕÙк Ó Úµ µ µ ÚÎ Proof. ÚÎ µ ÚÎ E µ ÙÚµ Úµ ÚÎ E µ ÚÙµ
µ ÒØÛÓÖº Ï ÙÑ ØØ ÜØÐÝ ÄØ ÓÙÖ Ò ÜØÐÝ ÓÒ Ò Øº ÓÒ ÐÐ ÚÐÙ ÚÖØÙ µ Ó Ø ÓÛ ³ Ò ¹ ÕÙÒØØÝ ³º ÒÓØ ÙÑ ØØ Î µ ÒÓ ÐÓÓÔ ÒÓÖ ÑÙÐØÔÐ Ï Ö ºº Î Î º ÖØ ÐÓÛ ÚÓÓµ ÓÒ Ø ÒØÛÓÖ µ ÙÒØÓÒ ³ Ê Ù ØØ ³ µ µ ÓÖ ÚÖÝ º ³ Úµ ³ Úµ ÓÖ ÚÖÝ Ú Î Ò Øº ÔÖÚÓÙ ÔÖÓÔÓ ØÓÒ ÑÔÐ ³ µ Ì Ì ³ صº Ì ÓÛ ÑÜÑÐ Ø ÚÐÙ Ø ÐÖ Ø ÔÓ Ðº
ÓÒ Ö ÒØÛÓÖ µ ÛØ Î µº ÈÖÓÔÓ ØÓÒº Î Î Î Ø Ù ØØ Î Ò Ø Î Ø º ÄØ ÄØ Î Î Ø µ Î Î µ Ø Î Î Ø µ ³ µ ³ µ ÌÒ Î Î Ø µ ÕÙÐ ØÓ Ø ÚÐÙ Ó ³º Proof. ÁÒÙØÓÒ ÓÚÖ Î º Á Î ØÒ Î º Ì Ø Î Î Ø ÓÒØÒ º Ø Ö ÓÖÒØÒ ÖÓÑ Ò Î Ø Î º ÐÐ ËØÔº ÄØ Ø ÐÑ ÓÐ ÓÖ ÓÑ Ø Î Ò Î Ø º ÄØ Î Ø ÒØ Î Î Ü Ò Î Ø Ü Î Ø Òܺ ÁØ ÒÓÙ ÔÖÓÚ Î Î Ø µ Î Î Ø µº ØÓ
Î Ø µ Î Î Î Ø µ Î Î Ü Î Ø Î Î Î Ü Î Ø Î Î ³ Î ³ ³ Ü ³ Ü ³ Ø ³ Î Ø ³ ³ Î Î Ø µ Î Î Ø µ Î Î Î Ü Î Ø Î Î ³ Ü ³ ³ Ø ³ Î ³ ܵ ³ ܵ
ÙØ Ðµ Ò Ø ÒØÛÓÖ µ ÛÖ Î µµ Ù Ò Ö Ø Ä ØØ ÚÖÝ ÖØ ÔØ ÖÓÑ Ä ÙØ ØÖ Ö ÒÓ ÖØ ÔØ ÐØÖÒØÚÐÝ ØÓ Ø Ò Ø ÖÔ Î Òĵº ÖÓÑ ÓÙÖ ØÓ Ò Ù ÓÑ Ö ÖÓÑ Ø Ø Äº Ð Úѵ Ó Ä Ø ÕÙÒØØÝ Äµ ÔØÝ È Ä µº Ì ÙØ ÑÒÑÐ Ø ÔØÝ Ø ÑÐÐ Ø ÔÓ Ðº
ÓÖ Ò ÙÐÖ ÓÒµº Ì ÚÐÙ Ó ÐÐ Ñܹ ÌÓÖÑ ÓÛ Ò ÒØÛÓÖ ÕÙÐ ØÓ Ø ÔØÝ Ó ÐÐ Ø ÑÐ Ì ÚÐÙ Ó ÒÓ ÓÛ ÐÖÖ ØÒ Ø ÔØÝ Ó ÒÝ Áº Ùغ ÓÖ ÒÝ ÑÜÑÐ ÓÛ ³ ØÖ Ü Ø ÙØ ÛØ ÔØÝ ÁÁº ³º ÑÒÑÐ ÙØ º Proof. ÄØ µ ÒØÛÓÖ ÛØ Î µ ÓÙÖ Ò Ò Øº Ï ÛÐÐ ÓÛ ØØ
Î Î Ø Ø Ó Ù ÒÓ Ú ØØ ØÖ Ü Ø ÄØ ÔØ ÖÓÑ ØÓ Ú ÛØÓÙØ Ù Ò ÒÝ Ö ÖÓÑ Äº ÖØ Î Î Ø µ Î Î Ø µ ÈÖØ Á ÄØ ³ ÓÛ Ò Ä Ùغ ÄØ Î Ø Î ÒÎ º ËÒ Î Î Ø µ Ä Û Ú Äµ µ ³ µ Î Î Ø µ ³
ÌÖ Ü Ø Ò ÙÒÖØ ÔØ Ú Ï Ý ØØ Ø ÓÛ ØÛÒ Ú Ú Ñ ÈÖØ ÁÁ ÄØ ³ ÑÜÑÐ ÓÛº ÄØ Î Î Ø Ø Ó ÐÐ ÚÖØ Ú Ù ØØ Ú Ñ Ú Ù ØØ Á Ú Ú µ ØÒ ³ µ µº Á Ú Ú µ ØÒ ³ µ º Ò Ú ÙÒ ØÙÖØ ÐÐ ØÑصº ËÙ ÔØ ÐÐ ÙÑÒØÒ ÙÙÖÒÚµº Î Ø Î ÒÎ º Ï ÛÐÐ ÓÛ ØØ Ø Î Ø º ÁÒ Ø Î ÄØ ³ ÒÓØ ÑÜÑÐ ØÒ
ÄØ Ú ÑÒ ÄØ Ú µ ³ µ Ú Ú µ Ñ Ú Ñ Ø ÓÑ ÙÑÒØÒ Ôغ Ò ÔÓ ØÚ ÖÐ ÒÙÑÖ Æ ÓÐÐÓÛ Æ ³ µ Ú Ú µ Æ Ò ÐØ ³ Ø ÓÐÐÓÛÒ ÓÛ ³ µ Ñ ³ µ ³ µ Ú Ú µ Ú Ú µ ³ µ ÌÒ ³ ÓÛ Ò ³ ³ º
ÓÒ ØÖÙØÓÒ Ó Ø Ø Î Ò Î Ø Ú Á Î Î Ø µ ØÒ ³ µ µº Á Î Ø Î µ ØÒ ³ µ º ÄØ Ä Î Î Ø µº ÌÒ Ä ÙØ Ò Äµ ³º
ÙÑÒØÒ ÔØ Ú Ú Ò Ò º ÙÑÒØÒ ÔØ ÓÙÒ ØÖÚÖ Ò Ø ÖÔ Ò ÓÑ Ì ÑÒÒÖº ÓÖ ÒÒ ÑÜÑÐ ÓÛ ÓÖ¹ÙÐÖ ÓÒµº ÐÓÖØÑ µ ÒØÛÓÖ ÛØ Î µº ÄØ ³ ÓÑ ÒØÐ ÓÛ ÓÒ Ø ÒØÛÓÖ µ Ý ÄØ º ³ µ ÊÔØ Ñ Ú Ñ Øº Á ØÖ ÒÓ Ù ÔØ ØÒ ØÓÔ Ò ÓÙØÔÙØ ³º º ÓÒ ØÖÙØ ³ Ö Ð Óº º Ò ³ ³ º
ÔÖÓÚ ØØ Ø Ó ÒÓØ ØÓÔ ÓÖ ÑÜÑÐ ÓÛ ØÓ ÓÙÒº ÛÐÐ ÓÛ ØØ ³ ÒÓØ ÑÜÑÐ ÓÛ ØÒ ØÖ Ï Ò ÙÑÒØÒ ÔØ Ø ÓÖ Øº Ü Ø Î Ø Ø Ó ÚÖØ Ú Ù ØØ ØÖ Ü Ø Ò ÄØ ÔØ ÖÓÑ ØÓ Ú Ò ÐØ Î Ø Î ÒÎ º ÙÑ ÙÑÒØÒ ØÓ Ø ÔÖÓÓ Ó Ø ÔÖÚÓÙ ØÓÖÑ Û Ø ØØ ËÑÐÖÐÝ Î Î Ø µ ÙØ Ò Äµ ³º ÌÙ ³ ÑÙ Ø Ä ÓÖ¹ÙÐÖ ÓÒ ÐÓÖØÑ Ò ÑÜÑÐ ÓÛº ÌÓÖѺ Ì ÐÓÖØÑ ÓÚÓÙ ÐÝ ÓÙØÔÙØ ÓÛº Ï Ò Proof. ØØ Ø Î Ø º ÑÜÑк
there is an augmenting path to these vertices 5 4 7 4 0 7 4 5 6 0 5 1 2 0 3 4 3 5 2 0 2 8 5 5 3 6 1 6 3 6 6 0 3 3 minimum cut: with circle without circle
ÓÖ Ò ÚÖØÜ Ú ÒÒØ ÛØ Ø Ø º ØÛÒ Ú Ò ³ ÓØÖ ÒÔÓÒØ Û ÙÒ ØÙÖØ ÓÛ ÒÒ Ø ÙÑÒØÒ ÔØ ÄØ Î Ï º ÏÐ Ï Ò Ø Î Ó º ËÓÑÓÛ ÓÓ Ú Ï º ÊÑÓÚ Ø ÖÓÑ Ø Ø Ï º Ò Û Î ØÒ µ Û ØÓ Ø Î Ò Ï º µ ÊÑÑÖ ØØ Ú Ø ÚÖØÜ ÔÖÒ Ûº Ø Î ØÒ ØÖ ÒÓ ÙÑÒØÒ Ôغ Á Ø Î Á Ò ÓÒ ØÖÙØ Ò ÙÑÒØÒ ÔØ ÑÓÚÒ ÖÓÑ Ø Ý ÓÒ ÔÖÒ ÚÖØ ØÓ º
ÔØ Ó ÐÐ Ø Ö ÒØÖ Á Ø ÑÒ ÝÐ Ó Ø ÐÓÖØÑ ÖÙÒ Ø ÑÓ Ø ³ ØÒ ÓÑÔÙØØÓÒ Ó ÒÓØ ÒØÖÓÙ ÒÓÒ¹ÒØÖ Ò¹ ÓÙÖ ØÓ Ø Ð Ø Ý º Ö ÈÖÓÔÓ ØÓÒº ØÑ ÛÖ ³ ÑÜÑÐ ÓÛº Proof. ØÖØÓÒ ÒÖ Ø ÚÐÙ Ó Ø ÓÛº ËÒ
ÛÐÐ ÒÓÛ ÙÑ ØØ Ø ÙÑÒØÒ ÔØ ÓÙÒ Ï ÖØ¹Ö Ø ØÖÚÖ Ð Ó Ø ÖÔ ÑÓÒ ¹ÃÖÔ Ù Ò Ì ÙÑÒØÒ ÔØ Ú ÓÖ Ø ÔØ Ú Ú Ú µ ÒØÛÓÖ ÛØ Î µ Ò ÐØ ³ ÄØ ÓÒ Øº ÒÓØ Ø ÐÒØ Ó Ø ÓÖØ Ø ÔØ ÖÓÑ ÓÛ ÐÓÖØѵº Ñ Ú Ñ Ø ÓÙÒ Ú ÛÐÐ Ú Ø ÓÐÐÓÛÒ ÔÖÓÔÖØÝ Ø ÓÖØ Ø ÙÑÒØÒ ÔØ ÖÓÑ ÓÙÖ ØÓ Ú º ÓÙÖ ØÓ Ú Î Æ ³ Úµº
ÄØ ³ ³ ³ Ø ÕÙÒ Ó ÓÛ ÈÖÓÔÓ ØÓÒº ÙÖÒ Ø ÑÜÑÐ ÓÛ ÒÒ ÐÓÖØѺ ÌÒ ÒÖØ ÐØ Ú Æ ³Ò Úµ Æ ³Ò Úµº ÙÑ ØØ ÒÓØ Ò Ò ÐØ Ú Ù ØØ Æ ³Ò Úµ Ø ÑÐÐ Ø ÑÔØÝ ÄØ È Ú Î Ø ÕÙÒ Æ ³ Úµ ÒÓÒ¹Ö Òº ÓÖ ÓÒ Ö Ø ÓÛ ³ Proof. Ò ³ Ò Ò Ø ÕÙÒ Ò ÔÓ Ðº Ø ÓÖØ Ø ÙÑÒØÒ ÔØ ÖÓÑ ÓÙÖ ØÓ Ú Ø ÓÛ ³ Ò º ÄØ Ù Ø ÚÖØÜ ÔÖÒ Ú ÓÒ ÛºÖºØ Ø Ôغ ËÒ Æ ³Ò Ùµ Æ ³Ò Úµ Û Ú Ù º ÓÒ Ö Ø ÓÛ ³ Ò ØÛÒ Ø ÚÖØ Ù Ò Úº
³ Ò Ø ÓÛ ØÛÒ Ù Ò Ú ÓÑ ÙÒ ØÙÖغ ÁÒ Ò Ø ÔØ È Ò ØÖ Ü Ø Ò Ú Ù ÌÙ Á ³ Ò ÙÒ ØÙÖØ ØÛÒ Ø ÚÖØ Ù Ò Ú ØÒ Æ ³Ò Úµ Æ ³Ò Ùµ Æ ³Ò Ùµ Æ ³Ò Úµ Ò Ú ÓÒØÖØÓÒº ³ Ò ØÙÖØ ØÛÒ Ø ÚÖØ Ù Ò Ú ØÒ ÐØ È Ò Á Ø ÙÑÒØÒ ÔØ ÖÓÑ ÓÙÖ ØÓ Ò ØØ Û Ù ØÓ ÒÖØ ³ Ò ÖÓÑ ³ Ò º º ÓÖÒ ØÓ Ø ÔÖÓÔÖØ Ó È Ò Û Ø Æ ³Ò Úµ ³Ò Ùµ º ÓÒ ÕÙÒØÐÝ Æ Æ ³Ò Úµ Æ ³Ò Ùµ Æ ³Ò Ùµ Æ ³Ò Úµ Æ ³Ò Úµ Ò Ú ÓÒØÖØÓÒº
ÑÓÒ ¹ÃÖÔ ÐÓÖØÑ Ñ Ø ÑÓ Ø ÌÓÖѺ µ ØÖØÓÒ º Î ØÖØÓÒ Ø ÙÑÒØÒ ÔØ È Ò Ú Ú Ñ ØÖØÓÒ ÖØÐ ÔÖ Ó ÚÖØ º ÇÒ Ø ÒÜØ Ø ÓÑ ØÙÖغ ØÖØÓÒ ÓÙÒØ Ø ÒÙÑÖ Ó ØÖØÓÒ ÛÖ ÔÖ Ù Úµ Ò Äس ÖØк Á Ø ÖØÐ ÓÒ Ø ÒØ ØÖØÓÒ Û Ú Proof. ÓÒ Ö Ø ÒØ ØÖØÓÒ Ó Ø ÐÓÖØѺ ÇÒ Ø Ñ Ø ÓÒ ØÖÙغ ÐÐ Ø ÔÖ Ó ÚÖØ Ú Ú µ Ú Ø Ö ÔØÚ ÕÙÒØØÝ Æ ÓÛÒ ÓÛ ÑÙ ÖØÐ ÓÛ ØÛÒ Ú Ò Ú ÑÙ Ø Ò ØÓ Ñ Ø Ø ØÙÖص ÑÒÑÐ ºº Æ µº Æ ³Ò Úµ Æ ³Ò Ùµ º
ÚÖÝ ØÑ ÛÒ Ù Úµ ÖØÐ Æ ³ Ùµ ÒÖ ØÙ Ð Ø Ý º Ø ÌÙ Ù Úµ ÖØÐ Ø ÑÓ Ø Î ÖØеº Ñ Úµ Ò ÖØÐ ÓÒ ØÖØÓÒ ÒÙÑÖ Ò Ò ÌÓ Ù Ü Ø ÒÓØÖ ÙÑÒØÒ ÔØ È Ò ÓÒØÒÒ ÑÙ Ø ØÖ Ø Ö Ú Ù º ÌÒ Æ ³Ò Ùµ Æ ³Ò Úµ Æ ³Ò Úµ Æ ³Ò Ùµ Ì ÕÙÒØØÝ Æ ³ Ùµ Ò ÒÓØ Ü Î ÛÒ Ù Úµ ØÑ º Ì ÒÙÑÖ Ó ÚÖØÜ ÔÖ Ù Úµ Ø ÑÓ Ø º
µ Let be a network. Also, let each edge of be assigned a µ Ê cost (possibly negative). ³ Let be a flow µ on the cost of the flow is ³µ µ³ µ µ We are looking for a maximum flow with the minimum cost.
Let Î µ µ, be a network (with any number of sources and sinks). Ê is a circulation (ringlus) on µ, if µ µ for all. Úµ Úµ for all Ú Î. Let Ê give the costs of edges. We re looking for a minimum-cost circulation in µ. Finding the minimum-cost maximum flow can be reduced to finding the minimum-cost circulation.
capacity cost 5 1 5 3 2 3 6 2 7 1 0 2 3 4 6 3 3 8 3 6 5 2 2 4 2 3 5 3 4 3 4 4 2 5
capacity cost 5 1 5 3 2 3 6 2 7 1 0 2 3 4 6 3 3 8 3 6 5 2 2 4 2 3 5 3 4 3 4 4 2 5 a lot (a lot)
Let µ, Î µ be a network and a circulation on it. The residual network (jääkvõrk) µ, made up of the residual graph Î µ and the residual circulation is defined as follows: For any Ù Úµ : µ If µ, then. E µ Ù Úµ Also, and µ µ µ. If µ, then. Also, E µ Ú Ùµ and µ µ.
5 4 7 5 6 5 2 8 3 6 3 6 3 5 2 3 4 7 4 3 1 1 0 5 0 2 2 0 4 0 3 1 6 5 16 14 2 14 3 2 2 2 3 5 1 2 1 1 5 4 7 5 6 1 2 3 2 4 4 1 5 6
µ µ µ µ µ Let be a circulation on µ and a circulation on the residual network µ. Define µ Ê by: (if some edge or on it equals ) does not exist, then assume that Theorem., as defined above, is a circulation on µ (for any ).
Proof.. First show that µ µ µ for any µ µ µ µ µ µ µ µ µ µ µ µ (again,, applied to a non-existing edge, gives )
Show that Úµ Úµ for any Ú Î. Úµ µ µ E µ ÙÚµ µ µ µ E µ ÙÚµ Úµ µ µ E µ ÙÚµ
We have Úµ µ µ E µ ÚÛµ E µ ÙÚµ Úµ µ µ E µ ÙÚµ E µ ÚÛµ Thus µ µ µ µ E µ ÙÚµ E µ ÚÛµ
µ µ Úµ Úµ Úµ µ µ E µ ÙÚµ Úµ µ µ E µ ÚÛµ µ µ µ E µ ÚÛµ E µ ÚÛµ
Let and be circulations on µ, Î µ. Let µ Ê be defined by: For any : if µ µ, then µ µ µ µ and µ µ ; if µ µ, then µ µ and µ µ µ. µ Theorem. µ. Theorem. µ., as defined above, is a circulation on Proofs are similar to the proof of the previous theorem.
Let be a circulation on Î µ, µ. Let give the costs of the edges of. Define the costs of Ê edges of µ as follows: µ µ for any. µ µ Theorem. Let be a circulation on µ, Î µ, and a circulation on the residual network µ. Let Ê give the costs of the edges of. Then µ µ. µ Proof: from the definition of.
Lemma. If the network Î µ µ, (the costs of edges are given by ) has no cycles with negative costs, then the minimum-cost circulation on this network is the zero circulation. Proof. Using mathematical induction over the cardinality of ÙÔÔ µ show that any circulation has a non-negative cost. Base. ÙÔÔ. Then µ.
µ if ÙÔÔ Ò Step.. Î Let Î be the set of all vertices, such that some edge with µ ends there. There are also edges µ with starting from all these vertices. Î Graph ÙÔÔ µ contains a directed cycle. Let Æ µ. Define the following circulation : ÑÒ µ Then ÙÔÔ ÙÔÔ and µ µ Æ µ. As µ Æ if µ, then µ µ.
Theorem. Let µ be a network, the costs of its edges, and a circulation on it. is minimal-cost iff the network µ has no cycles of negative cost. Proof. µ. If µ had cycles of negative cost, then it also would contain a negative-cost circulation. But then would have smaller cost than.. Let be a circulation on µ whose cost is not minimal. Let be a minimal-cost circulation on µ. Then is a negative-cost circulation on µ. Hence it also contains cycles of negative cost.
Algorithm to find a minimum-cost circulation µ in with the costs of edges. Let be some initial circulation. Repeat: 1. Find a negative-cost cycle in µ. If such does not exist, then is a circulation of minimum cost. 2. Let Æ ÑÒ µ. Let be a circulation in µ, such that µ Æ or µ, depending on whether lies on or not. 3. Set. The initial may be found using e.g. the Ford-Fulkerson algorithm.
5 5 3 5-3 5 2 3 6 7 2 3 0 1 5 2 7 2 1 6 7 1 0 0 6-2 3 2 2 1 6 0 2 4 6 3 3-2 3 4 8 5 3-34 3 3-2 -5 6 6 2 6 5 2 0 4 5 1 5 1 5 4 02 3 2-1 2-3 4 0 5 3 2 2 3 4-4 4 3 2 3-4 1 3 1 1 4 1 4 4 3-4 3
5 5 3 5-3 5 2 3 6 7 2 3 0 1 5 2 7 2 1 6 7 1 0 0 6-2 3 2 2 1 6 0 2 4 6 3 3-2 3 4 8 5 3-34 3 3-2 -5 6 6 2 6 5 2 0 4 5 1 5 1 5 4 02 3 2-1 2-3 4 0 5 3 2 2 3 4-4 4 3 2 3-4 1 3 1 1 4 1 4 4 3-4 3
5 5 3 5-3 5 2 3 6 7 2 3 0 1 5 2 7 2 1 6 7 1 0 0 6-2 3 2 2 1 6 0 2 4 6 3 3-2 3 4 8 4 3-34 4 3-2 -5 6 6 2 6 5 2 1 4 5 4 0 4 4 02 3 2-1 2-3 4 0 5 3 3 2 3 4 4 3 2 3-4 1 3 1 4 4 4 1-4 4
Bellman-Ford s algorithm may be used to find a cycle of negative cost. Add an additional vertex Ü to. Add arcs of cost from Ü to all other vertices. Find the distances of all vertices from (length of edge cost of edge); also find the shortest Ü paths. If something happens at the Î -th iteration of the Bellman- Ford algorithm, then the back-pointers of all vertices (to previous vertices on shortest paths) will give us a cycle of negative length.