ÙÐÖÒ ÖÔ
ÔÖ Î µ ÛÖ Î Ø Ø Ó ÚÖØ ÖÔ Ø Ø Ó º ØØ Û Ö ÚÒ Ø Ò Ú ¼ ½ Ú ½ ¾ Ú ¾ Ú Ú ½ ÒÒ ÙÒØÓÒ Eº ÏÐ Ò Ø ÖÔ ÕÙÒ Ú ÛÖ Ú ¼ Ú ¾ Î ½ ¾ Ò E µ Ú ½ Ú º Ì ÛÐ ÐÓ Ø Ö Ø Ò Ð Ø ÚÖØ ÓÒº ÈØ ÛÐ ÛÖ ÚÖÝ ÚÖØÜ ÓÙÖ Ø ÑÓ Ø ÓÒº ÝÐ ÐÓ Ôغ
ÛÐ Ò Ø ÖÔ Î µ ÐÓ ÛÐ ÙÐÖÒ ÜØÐÝ ÓÒº ÓÚÖÒ ÖÔ ØØ ÒÓÒ¹ÐÓ ÛÐ ÓÚÖÒ ÓÒ ÐРѹÙÐÖÒº ÜØÐÝ ÛÐйÒÓÛÒ Ð Ó ÔÙÞÞÐ ÖÛ Ø ÙÖ ÛØÓÙØ Ö ¹ Ø ÔÒ ÖÓÑ Ø ÔÔÖ Ò ÓÚÖÒ ÐÒ ÜØÐÝ Ò ÙÐÖÒ ÖÔ ÖÔ ÛØ ÙÐÖÒ Ûк ÓÒº
¾ ½¾ ½ ½ ½¼ ½½ ¾ ¾ ¾ ½¼ ½ ½
ÇÖÒÐ ÔÖÓÐÑ
Ò ÖÔÖ ÒØ ÙÒÓÒ Ó ¹Û ÒÓÒ¹ µº ÝÐ º ÒØÖ ØÒ ÌÓÖѺ ÄØ Î µ ÓÒÒØ ÖÔº Ì ÓÐÐÓÛÒ Ö ÕÙÚÐÒØ µº ÙÐÖÒ ÖÔº µº ÐÐ ÚÖØÜ Ö Ó Ö ÚÒº
ÛÐ È ÒØÖ Ú ÓÑ ÒÙÑÖ Ó ØÑ Ò Ð Ó ÜØ Ì Ø Ñ ÒÙÑÖ Ó ØÑ º ÌÙ Ø ÒÙÑÖ Ó Ó Ø Ø ÓØÖ Ò È ÙÐÖÒ ÛÐ ØÙ Ø Ó ÇÒ ÒÒØ ÛØ Ú Ö ÜØÐÝ ÐÐ Ø Ó ÒÒØ È Proof µµ µº ÄØ È ÓÑ ÙÐÖÒ ÛÐ Ó Ò ÐØ Ú ¾ Î º È ÒÒØ ÛØ Ú ÚÒ Ò ÐÓÓÔ Ö ÓÙÒØ ØÛµº ÛØ Úº
¼º ÌÒ ÙÒÓÒ Ó ¼ Ô ÓÒ Ó º º º º º ØÑ ¼º ËÒ ÓÒÒØ ÐÐ Ø ÚÖØÜ Ö ËØÔº ÔÓ ØÚº ÑÙ Ø ØÓÖÑ ÖÓÑ Ø ÔÖÚÓÙ ÐØÙÖ ØÖ ÝÐ Í Ò Ò º ÌÓÖѺ Á ÐÐ Ø ÚÖØÜ Ö Ò ÖÔ Ö Ø Ð Ø ¾ ØÒ ØÖ Proof µµ µº ÁÒÙØÓÒ ÓÚÖ º ÓÖÒ ØÓ µ ÐÐ Ø ÚÖØÜ Ö Ö ¾º ÝÐ Ò Ø ÖÔº
ÐÐ Ø Ó ÖÓÑ ÖÔ ÐØ Ø ÖÑÒÒ ÐØ ¼ º ÖÔ À ½ À Ø ÓÒÒØ ÓÑÔÓÒÒØ Ó ÖÔ ¼ º ÄØ ÝÔÓØ ÑÔÐ ØØ Ó ØÑ Ò ÖÔ¹ ÁÒÙØÓÒ ÙÒÓÒ Ó ¹Û ÒÓÒ¹ÒØÖ ØÒ ÝÐ º Ö ÒØ Ø ÝÐ ØÓ Ø ÙÒÓÒ Ó Ø ÖÔÖ ÒØØÓÒ Ò ¼ Ð ØÒ Ò ÐÐ Ø ÚÖØÜ Ö Ö ØÐÐ ÚÒº Û Ú ÓØÒ Ø ÖÕÙÖ ÖÔÖ ÒØØÓÒ ÓÖ º
ÙÑ ØØ ÚÖÝ ÝÐ ½µ ÓÑÑÓÒ ÏºÐºÓº ÛØ ÓÑ ÝÐ µº ÚÖØÜ ÛÐÐ ÒÓÛ ÓÒ ØÖÙØ ÐÓ ÛÐ È ½ È Ò Ó ØØ Ï ÓÚÖ Ó Ø ÝÐ ½ ÜØÐÝ ÓÒ È Proof µµ µº ÄØ ½ ¾ Ò ÛÖ ½ Ò Ö ÝÐ º Á Ò ½ Ø ÐÑ ÐÖº ÙÑ Ò ¾º Ò Ó ÒÓØ ÓÚÖ ÒÝ ÓØÖ º
ÅÓÚ ÐÓÒ Ø ÛÐ È ½ ÄØ Ø ÐÓ ÛÐ È ½ Ø ÝÐ ½ º ÓÒ ØÖÙØ Ø ÛÐ È ÓÒ Ø ÛÐ È ½ ÓÐÐÓÛ º ÙÒØÐ Û Ø ÚÖØÜ Ð Ó ÔÖ ÒØ Ò Ø ÝÐ º ÓÐÐÓÛ Ø ÝÐ ØÖØÒ Ò Ò Ò Ò ÚÖØÜ Úº ÅÓÚ ÐÓÒ Ø Ö Ø Ó Ø ÛÐ È ½ º Ì ÛÐ È Ò ÙÐÖÒ ÓÒ Ò ÖÔ º
ÔÖÓÓ Ú Ò ÐÓÖØÑ ÓÖ ÒÒ ÙÐÖÒ ÝÐ Ì ÙÐÖÒ ÖÔ Ò ÓÒ ØÖÙØ ÓÒ Ó Ø ÝÐ Ý º ÅÓÚ ÐÓÒ Ø Ó ÙÒØÐ Û Ö ÓÑ ÈÖØØÓÒ Ø Ó Ø ÓÒÒØ ÓÑÔÓÒÒØ Ó ÛØÓÙØ µ ØÓ ÝÐ º ÓÒ ØÖÙØ ÙÐÖÒ ÛÐ ÓÛÒ Ò Ø ÔÖÚÓ٠к ÈÖØØÓÒ µ ÒØÓ ÝÐ º ÚÖØÜ ÓÖ Ø ÓÒ ØѺ ÊÑÓÚ Ø Ó ÖÓÑ ÖÔ º ÇÙØÔÙØ Ø ÝÐ Ò Ø ÝÐ º
½ ¾
¾ ½
½¼ ¾ ½ ½½ ½¾
ÓÒÒØ ÖÔ Ñ¹ÙÐÖÒ Ø ÓÖÓÐÐÖݺ ÜØÐÝ ØÛÓ ÚÖØ ÛØ Ó Öº ÖÔ Ì ÖÔ Û ÓØÒ ÙÐÖÒ Ü È Ý Ü ÙÐÖÒ Ò Ø ÓÖÒÐ ÖÔ Ü Ò Ý Ú Ó Ö Ò ÀÒ Ø ÓØÖ ÚÖØ Ú ÚÒ Ö º ÐÐ Proof µº ÄØ Ü È Ý ÛÐ Ò ÓÚÖÒ Ó Ø Ó ÜØÐÝ ÓÒº Ò ØÓ Ó ØØ E µ Ü Ýº Ûе ØÙ ÐÐ Ø ÚÖØÜ Ö Ö ÚÒº
Ö ÙÐØ ÐÐ Ø ÚÖØÜ Ö ÓÑ ÚÒ ØÙ ØÖ ÙÐÖÒ ÛÐ È º Ü Ø ÙÑ ØØ Ø Ð Ø Ò Ø ÛÐ º ʹ ϺкӺ Ø ÖÓÑ È Û ÓØÒ Ø ÖÕÙÖ Ûк ÑÓÚÒ Ò ØÓÒÐ Ò Ø ÙÐÖÒ ÛÐ Ò ÖÓÔ ÖÓÑ Øº ØÒ Proof º ÄØ Ü Ò Ý Ø ØÛÓ ÚÖØ Ó ÚÒ Ó Öº Ò ØÓ Ó ØØ E µ Ü Ýº Ì ÔÖÓÓ Ú Ò ÐÓÖØÑ ÓÖ ÒÒ Ù ÛÐ
ÐÓÖØÑ ÓÖ ÒÒ ÙÐÖÒ ÛÐ Ò Ùй ÐÙÖݳ ÖÔ Î µ ÖÒ È ÒÝ ÚÖØÜ Ù ¾ Î Ø Ö Ø ÓÒ Ò Ø Ûк ÄØ ½º ¼ Ò Ú ¼ Ùº È Ò ÒÒØ ÛØ ÚÖØÜ Ú Ø ØÓ Ø ¾º Ò ÐØ Ø ÖÓÑ Ø ÖÔ º ÄØ Ú ½ Ø ÛÐ Á Ö Ô Ø ÓÒÐÝ ØÖ ÒÓ ÓØÖ ÐØÖÒØÚº ÓØÖ ÒÔÓÒØ Ó Ò ÐØ ½º º ÊÔØ Ø Ð Ø ØÔ ÙÒØÐ ÐÐ Ø Ö Ðغ
ÐÙÖݳ ÐÓÖØÑ ÓÖÖØ ºº Ø ÛÐÐ ÐÛÝ ÌÓÖѺ Ù ÙÐÐÝ Ò ÔÖÓÙ ÙÐÖÒ Ûеº ÖÙÒ ÐÐ Ø ÒÒØ Ðغ ÓÒ ÖÒ Ø ØØ Ö Ø ÓÚÓÙ ØØ Ú Ò Ùº ÚÖØÜ Ú ØÓ ÓÛ ØØ Ø ØØ ÑÓÑÒØ ÐÐ Ø Ö Ï Ðغ Ì ÐÓÖØÑ ÔÖÓÙ ÓÑ ÛÐ È ØÖØÒ ÖÓÑ Proof. Ø ÓÑ ÔÓÒØ Ø ØÓÔ Ù Ø Ö ÚÖØÜ Ú Ò Ùº
Ø ÖÔ ÖÑÒÒ Ó ØÖ ØÔ º ÌÒ ÄØ ¼ Ò ½ ÓÒØÒ ÓÒ Ð ØÒ Ø ÖÔ ØØ Ø Ö Ó ÐÐ Ø ÚÖØ Ó ÜÔØ ÓÖ ÆÓØ Ù Ò Ú µ Ö ÚÒº Á Ù Ú ØÒ Ð Ó Ùµ ÔÓ ÐÝ ÛÐÐ ÓÛ ØØ ÐÐ Ø ÖÑÒÒ ÓÒÒØ ÓÑÔÓÒÒØ Ï Ö ÓÐØ ÚÖØ º Ó ÛÐÐ Ù ÒÙØÓÒ ÓÚÖ º Á ¼ ØÒ ¼ À ¼ Ï ¼ ÓÒÐÝ ÓÒ ÓÒÒØ ÓÑÔÓÒÒØ ØÙ Ø ÐÑ Ò º ÄØ À Ø ÓÒÒØ ÓÑÔÓÒÒØ Ó ÓÒØÒÒ Ø ÚÖØÜ Ùº ÚÒº Á Ù Ú ØÒ Ùµ Ò Ú µ Ö Óº ÓÐ º
Ø ÐÑ ÓÐ ÓÖ º ÓÒ Ö Ö Ø Ø Ù Ú º ÄØ ÓÖÖ ØÓ Ú Ø ÔÖÓÓ ÓÖ ½ Ø ÒÓÙ ØÓ ÔÖÓÚ ÁÒ ØØ ØÖ Ø ÑÓ Ø ÓÒ Ö ÒÒØ ÛØ Ú Á Ó ØÒ Û Ö ÓÒ Ù Ø ÓÒÒØ ÓÑÔÓ¹ Ó ½ Ö Ø ÓÐÐÓÛÒº ÒÒØ Á Û ÐØ ÒÓÒ¹Ö Ø ÓÒÒØ ÓÑÔÓ¹ ÒÓØ Òº ÒÒØ Á Û ÐØ Ö Ø Û Ø Ð Ø ÒÒØ Ú º Ì ÓÑÔÓÒÒØ À Ú ÒØÓ ØÛÓ ÒÛ ÛØ Ú Ò À ½ À ÒÚº Ì Ö Ø ÓÒ ÓÑÔÓÒÒØ ÓÐØ ÚÖØÜ Ø ÓÒ ÓÒ ÓÒØÒ ÚÖØÜ Ò Ò Ø ÖÔ º Ùº
À Ú ÌÖ Ü Ø Ò ÒÒØ ØÓ Ú ÓÑÔÓÒÒØ Ó À ÒÓØ ÓÒØÒÒ Ú Ó ÓÒÒØ ÓÒØÒ Ù ØÖº ÒÓØ ÌÖ ØÓ Ü Ø ÒÓØÖ ÚÖØÜ Û Ó Ã Ó ØØ Ã Ûµ Óº Ø Ø Ñ ØÑ Ã Ûµ À Ûµ Á Ø Ð Ø ØÛÓ Ö ÛÖ ÒÒØ ØÓ Ú ØÒ Ù Û Ü Ã Ù ØØ Ø À ܵ ÚÒº Ì٠à ܵ Óº Ò Ø ØÓ ÚÒº
Ù Ú Ø ÒÓÙ ØÓ ÓÛ ØØ ØÖ Ö ÒÓ Ö Á ÛØ Ù ºº Ò ½ Ú Ø Ñ ÓÒÒØ ÒÒØ À Ù Ú ÓÑÔÓÒÒØ º Á Ù ÛÓÙÐ Ú Ò ÒÒØ Ö Û Ü Ã ØÖ ÛÓÙÐ Ò Ü Ø ÚÖØÜ Û ÛØ Ó Öº
Let the edges of the graph Î Eµ have non-negative weights ( lengths ). Let the function Û Ê give the lengths. If È ½ ¾ È ½ Û µ be its length. is a walk then let Û È µ Chinese postman problem (Hiina postiljoniprobleem) (CPP): find the closed walk of minimum length that passes each edge at least once. Obviously, if is Eulerian the the solution to CPP is any Eulerian walk.
Tasks that reduce to CPP (or its variants): Routing postmen, garbage trucks, snowplows, etc. Checking the transportation routes (highways, railways, power lines, etc.) Optimizing the testing strategies of state automata (e.g. UIs) A test: does the system in state go to state after the action?
Let a pseudo-eulerian walk be a closed walk that passes through all edges of a graph at least once. CPP is looking for a pseudo-eulerian walk of minimum length. Let È be a pseudo-eulerian walk in the graph. Define the graph È Î È E È µ as follows: È µ ½ È, E È µ µ E µ, where È is the number of occurrences of in È.
Proposition. È is an Eulerian graph for any graph and pseudo-eulerian walk È. Proof. Replace the -th occurrence of an edge È in with µ. This gives an Eulerian walk in È.
In the other direction, let Æ. Define Î E µ, as follows: µ ½ µ, E È µ µ E µ, If µ ¼ for all ¾ and is an Eulerian graph then each Eulerian walk in in. defines a pseudo-eulerian walk The lengths of all pseudo-eulerian walks resulting from are equal. they equal È ¾ µû µ.
Proposition. In the solution to CPP, no edge occurs more than twice. È Proof. Let be the solution to Î CPP in Eµ. Assume ¾ the opposite:, Ò È such that. Consider the graph È. It is an Eulerian graph. Remove and from Òµ Ò ½µ È, giving. It is still an Eulerian graph ¾ and ½µ µ. ¾ For all, contains at least one copy of. Hence an Eulerian walk in is a pseudo-eulerian walk in. The cost of such a Û È µ ¾Û µ Û È walk is µ. A generalization:...
Proposition. È Let be a solution to CPP Î in Eµ. µ È Let ½. Then does not contain cycles. Proof. Assume that the graph contains a cycle. Let ¼ µ È. Then ¼ µ ¼ for any ¾. ¼ is an Eulerian graph, giving pseudo-eulerian walks in with the cost Û È µ Û µ.
Theorem. Let Î Eµ a graph and let Î Î be the set of vertices of odd degree in. The Î set can be partitioned to Î Ù pairs Ú ½ Ù ¾ Ú ¾ Ù Ò Ú Ò ½ ; (let È be the shortest path from Ù to Ú ) such that an edge occurs twice in a CPP solution È for iff this edge belongs to one of È ½ È Ò. In other words, the edges of (from the previous proposition) are made up of È ½ È Ò.
Proof. Consider this graph. Then Úµ Úµ ÑÓ ¾µ for any Ú ¾ Î, because Úµ È Úµ Úµ and È is Eulerian. Let ¼ and Ò Î ¾. For all ¾ ½ Ò define let Ù Ú ¾ Î be two vertices of odd degree in the same connected component of ½ ; let È be a path from Ù to Ú in ½ ; let be a graph obtained from it the edges È of. ½ be removing from
In, the degrees of Ù and Ú are even and the parity of degrees of other vertices did not change from ½. In Ò, all vertices have even degree. Consider a connected component of Ò. If it is not an isolated vertex, then it contains a cycle. The same cycle exists in. This contradicts the last proposition. Hence Ò contains no edges. We have partitioned the edges of to Ò paths. È is the solution to CPP, hence these paths must be of minimal length between their endpoints.
Algorithm for solving CPP in the graph Î Eµ: 1. Find the pairwise distances between all vertices in Î Î. It makes sense to use e.g. Floyd-Warshall algorithm to find the pairwise distances between all vertices. Find the corresponding shortest paths, too. 2. Partition Î to pairs Ù Ú in such a way, that the summary length of distances between Ù and Ú is as small as possible. This can be done in polynomial time. We might see an algorithm in one of the following lectures. 3. Augment with a copy of edges on some of the shortest paths between Ù and Ú. Find an Eulerian walk in the resulting graph.
Example: f 1 6 b 3 2 g 4 4 5 1 5 e 3 6 c a d Distances between vertices of odd degree: 2 b d f g b X 6 6 4 d 6 X 7 5 f 6 7 X 2 g 4 5 2 X The pairs and give the minimum summary length.
The solution to CPP is an Eulerian walk in the graph a f 1 6 b 3 2 g 4 4 5 1 5 e 3 6 c d 2