Corrections
This commit is contained in:
		
							parent
							
								
									3815102556
								
							
						
					
					
						commit
						ae810e0b1c
					
				
							
								
								
									
										436
									
								
								luku20.tex
								
								
								
								
							
							
						
						
									
										436
									
								
								luku20.tex
								
								
								
								
							|  | @ -556,17 +556,25 @@ as a cut in the graph. | ||||||
| Thus, the flow has to be a maximum flow, | Thus, the flow has to be a maximum flow, | ||||||
| and the cut has to be a minimum cut. | and the cut has to be a minimum cut. | ||||||
| 
 | 
 | ||||||
| \section{Parallel paths} | \section{Disjoint paths} | ||||||
| 
 | 
 | ||||||
| As a first application for flows, | Many graph problems can be solved by reducing | ||||||
| we consider a problem where the task is to | them to the maximum flow problem. | ||||||
| form as many parallel paths as possible | Our first example of such a problem is | ||||||
| from the starting node of the graph | as follows: we are given a directed graph | ||||||
| to the ending node. | with a source and a sink, | ||||||
| It is required that no edge appears | and our task is to find the maximum number | ||||||
| in more than one path. | of disjoint paths from the source to the sink. | ||||||
| 
 | 
 | ||||||
| For example, in the graph | \subsubsection{Edge-disjoint paths} | ||||||
|  | 
 | ||||||
|  | We will first focus on the problem of | ||||||
|  | finding the maximum number of | ||||||
|  | \key{edge-disjoint paths} from the source to the sink. | ||||||
|  | This means that we should construct a set of paths | ||||||
|  | such that each edge appears in at most one path. | ||||||
|  | 
 | ||||||
|  | For example, consider the following graph: | ||||||
| \begin{center} | \begin{center} | ||||||
| \begin{tikzpicture}[scale=0.9] | \begin{tikzpicture}[scale=0.9] | ||||||
| \node[draw, circle] (1) at (1,2) {$1$}; | \node[draw, circle] (1) at (1,2) {$1$}; | ||||||
|  | @ -586,10 +594,12 @@ For example, in the graph | ||||||
| \path[draw,thick,->] (5) -- (6); | \path[draw,thick,->] (5) -- (6); | ||||||
| \end{tikzpicture} | \end{tikzpicture} | ||||||
| \end{center} | \end{center} | ||||||
| we can form two parallel paths from node 1 to node 6. | 
 | ||||||
| This can be done by choosing paths | In this graph, the maximum number of edge-disjoint | ||||||
|  | paths is 2. | ||||||
|  | We can choose the paths | ||||||
| $1 \rightarrow 2 \rightarrow 4 \rightarrow 3 \rightarrow 6$ | $1 \rightarrow 2 \rightarrow 4 \rightarrow 3 \rightarrow 6$ | ||||||
| and $1 \rightarrow 4 \rightarrow 5 \rightarrow 6$: | and $1 \rightarrow 4 \rightarrow 5 \rightarrow 6$ as follows: | ||||||
| 
 | 
 | ||||||
| \begin{center} | \begin{center} | ||||||
| \begin{tikzpicture}[scale=0.9] | \begin{tikzpicture}[scale=0.9] | ||||||
|  | @ -620,19 +630,29 @@ and $1 \rightarrow 4 \rightarrow 5 \rightarrow 6$: | ||||||
| \end{tikzpicture} | \end{tikzpicture} | ||||||
| \end{center} | \end{center} | ||||||
| 
 | 
 | ||||||
| It turns out that the maximum number of parallel paths | It turns out that the maximum number of | ||||||
| equals the maximum flow in the graph when the weight | edge-disjoint paths | ||||||
| of each edge is 1. | equals the maximum flow of the graph, | ||||||
|  | assuming that the capacity of each edge is one. | ||||||
| After the maximum flow has been constructed, | After the maximum flow has been constructed, | ||||||
| the parallel paths can be found greedily by finding | the edge-disjoint paths can be found greedily | ||||||
| paths from the starting node to the ending node. | by following paths from the source to the sink. | ||||||
| 
 | 
 | ||||||
| Let's then consider a variation for the problem | \subsubsection{Node-disjoint paths} | ||||||
| where each node (except for the starting and ending nodes) | 
 | ||||||
| can appear in at most one path. | Let us now consider another problem: | ||||||
| After this restriction, we can construct only one path | finding the maximum number of | ||||||
| in the above graph, because node 4 can't appear | \key{node-disjoint paths} from the source | ||||||
| in more than one path: | to the sink. | ||||||
|  | In this problem, every node, | ||||||
|  | except for the source and sink, | ||||||
|  | may appear in at most one path. | ||||||
|  | The number of node-disjoint paths is | ||||||
|  | often smaller than the number of | ||||||
|  | edge-disjoint paths. | ||||||
|  | 
 | ||||||
|  | For example, in the previous graph, | ||||||
|  | the maximum number of node-disjoint paths is 1: | ||||||
| 
 | 
 | ||||||
| \begin{center} | \begin{center} | ||||||
| \begin{tikzpicture} | \begin{tikzpicture} | ||||||
|  | @ -659,14 +679,17 @@ in more than one path: | ||||||
| \end{tikzpicture} | \end{tikzpicture} | ||||||
| \end{center} | \end{center} | ||||||
| 
 | 
 | ||||||
| A standard way to restrict the flow through a node | We can reduce also this problem to the maximum flow problem. | ||||||
| is to divide the node into two parts. | Since each node can appear in at most one path, | ||||||
| All incoming edges are connected to the first part, | we have to limit the flow that goes through the nodes. | ||||||
| and all outgoing edges are connected to the second part. | A standard method for this is to divide each node into | ||||||
| In addition, there is an edge from the first part | two nodes such that the first node has the incoming edges | ||||||
| to the second part. | of the original node and the second node has the outgoing | ||||||
|  | edges of the original node. | ||||||
|  | In addition, there is a new edge from the first node | ||||||
|  | to the second node. | ||||||
| 
 | 
 | ||||||
| In the current example, the graph becomes as follows: | In our example, the graph becomes as follows: | ||||||
| \begin{center} | \begin{center} | ||||||
| \begin{tikzpicture} | \begin{tikzpicture} | ||||||
| \node[draw, circle] (1) at (1,2) {$1$}; | \node[draw, circle] (1) at (1,2) {$1$}; | ||||||
|  | @ -742,35 +765,34 @@ The maximum flow for the graph is as follows: | ||||||
| \end{tikzpicture} | \end{tikzpicture} | ||||||
| \end{center} | \end{center} | ||||||
| 
 | 
 | ||||||
| This means that it is possible to form exactly | Thus, the maximum number of node-disjoint paths | ||||||
| one path from the starting node to the ending node | from the source to the sink is 1. | ||||||
| when a node can't appear in more than one path. |  | ||||||
| 
 | 
 | ||||||
| \section{Maximum matching} | \section{Maximum matchings} | ||||||
| 
 | 
 | ||||||
| \index{matching} | \index{matching} | ||||||
| \index{maximum matching} | \index{maximum matching} | ||||||
| 
 | 
 | ||||||
| A \key{maximum matching} is the largest possible | The \key{maximum matching} problem asks to find | ||||||
| set of pairs of nodes in a graph | a maximum-size set of node pairs in a graph | ||||||
| such that there is an edge between each pair of nodes, | such that each pair is connected with an edge and | ||||||
| and each node belongs to at most one pair. | each node belongs to at most one pair. | ||||||
| 
 | 
 | ||||||
| There is a polynomial algorithm for finding | There are polynomial algorithms for finding | ||||||
| a maximum matching in a general graph, | maximum matchings in general graphs, | ||||||
| but it is very complex. | but such algorithms are complex and do | ||||||
| For this reason, we will restrict ourselves to the | not appear in programming contests. | ||||||
| case where the graph is bipartite. | However, in bipartite graphs, | ||||||
| In this case we can easily find the maximum matching | the maximum matching problem is much easier | ||||||
| using a maximum flow algorithm. | to solve, because we can reduce it to the | ||||||
|  | maximum flow problem. | ||||||
| 
 | 
 | ||||||
| \subsubsection{Finding a maximum matching} | \subsubsection{Finding maximum matchings} | ||||||
| 
 | 
 | ||||||
| A bipartite graph can be always presented so | The nodes in a bipartite graph can be always | ||||||
| that it consists of left-side and right-side nodes, | divided into two groups such that all edges | ||||||
| and all edges in the graph go between | of the graph go from the left group to the right group. | ||||||
| left and right sides. | For example, consider the following bipartite graph: | ||||||
| As an example, consider the following graph: |  | ||||||
| 
 | 
 | ||||||
| \begin{center} | \begin{center} | ||||||
| \begin{tikzpicture}[scale=0.60] | \begin{tikzpicture}[scale=0.60] | ||||||
|  | @ -813,20 +835,20 @@ In this graph, the size of a maximum matching is 3: | ||||||
| 
 | 
 | ||||||
| \path[draw=red,thick,-,line width=2pt] (1) -- (5); | \path[draw=red,thick,-,line width=2pt] (1) -- (5); | ||||||
| \path[draw=red,thick,-,line width=2pt] (2) -- (7); | \path[draw=red,thick,-,line width=2pt] (2) -- (7); | ||||||
| \path[draw=red,thick,-,line width=2pt] (3) -- (6); | \path[draw=red,thick,-,line width=2pt] (3) -- (8); | ||||||
| \end{tikzpicture} | \end{tikzpicture} | ||||||
| \end{center} | \end{center} | ||||||
| 
 | 
 | ||||||
| A maximum matching in a bipartite graph | We can reduce the bipartite maximum matching problem | ||||||
| corresponds to a maximum flow in an extended graph | to the maximum flow problem by adding two new nodes | ||||||
| that contains a starting node, | to the graph: a source and a sink. | ||||||
| an ending node and all the nodes of the original graph. | In addition, we add edges from the source | ||||||
| There is an edge from the starting node to | to each left node and from each right node to the sink. | ||||||
| each left-side node, and an edge from  | After this, the maximum flow of the graph | ||||||
| each right-side node to the ending node. | equals the maximum matching of the original graph. | ||||||
| The capacity of each edge is 1. |  | ||||||
| 
 | 
 | ||||||
| In the example graph, the result is as follows: | For example, the reduction for the above | ||||||
|  | graph is as follows: | ||||||
| \begin{center} | \begin{center} | ||||||
| \begin{tikzpicture}[scale=0.60] | \begin{tikzpicture}[scale=0.60] | ||||||
| \node[draw, circle] (1) at (2,4.5) {1}; | \node[draw, circle] (1) at (2,4.5) {1}; | ||||||
|  | @ -859,35 +881,74 @@ In the example graph, the result is as follows: | ||||||
| \end{tikzpicture} | \end{tikzpicture} | ||||||
| \end{center} | \end{center} | ||||||
| 
 | 
 | ||||||
| The size of a maximum flow in this graph | The maximum flow of this graph is as follows: | ||||||
| equals the size of a maximum matching | \begin{center} | ||||||
| in the original graph, | \begin{tikzpicture}[scale=0.60] | ||||||
| because each path from the starting node | \node[draw, circle] (1) at (2,4.5) {1}; | ||||||
| to the ending node adds one edge to the matching. | \node[draw, circle] (2) at (2,3) {2}; | ||||||
| In this graph, the maximum flow is 3, | \node[draw, circle] (3) at (2,1.5) {3}; | ||||||
| so the maximum matching is also 3. | \node[draw, circle] (4) at (2,0) {4}; | ||||||
|  | \node[draw, circle] (5) at (8,4.5) {5}; | ||||||
|  | \node[draw, circle] (6) at (8,3) {6}; | ||||||
|  | \node[draw, circle] (7) at (8,1.5) {7}; | ||||||
|  | \node[draw, circle] (8) at (8,0) {8}; | ||||||
|  | 
 | ||||||
|  | \node[draw, circle] (a) at (-2,2.25) {\phantom{0}}; | ||||||
|  | \node[draw, circle] (b) at (12,2.25) {\phantom{0}}; | ||||||
|  | 
 | ||||||
|  | %\path[draw,thick,->] (1) -- (5); | ||||||
|  | %\path[draw,thick,->] (2) -- (7); | ||||||
|  | \path[draw,thick,->] (3) -- (5); | ||||||
|  | \path[draw,thick,->] (3) -- (6); | ||||||
|  | %\path[draw,thick,->] (3) -- (8); | ||||||
|  | \path[draw,thick,->] (4) -- (7); | ||||||
|  | 
 | ||||||
|  | \path[draw,thick,->] (a) -- (1); | ||||||
|  | \path[draw,thick,->] (a) -- (2); | ||||||
|  | \path[draw,thick,->] (a) -- (3); | ||||||
|  | \path[draw,thick,->] (a) -- (4); | ||||||
|  | \path[draw,thick,->] (5) -- (b); | ||||||
|  | \path[draw,thick,->] (6) -- (b); | ||||||
|  | \path[draw,thick,->] (7) -- (b); | ||||||
|  | \path[draw,thick,->] (8) -- (b); | ||||||
|  | 
 | ||||||
|  | \path[draw=red,thick,->,line width=2pt] (1) -- (5); | ||||||
|  | \path[draw=red,thick,->,line width=2pt] (2) -- (7); | ||||||
|  | \path[draw=red,thick,->,line width=2pt] (3) -- (8); | ||||||
|  | 
 | ||||||
|  | \path[draw=red,thick,->,line width=2pt] (a) -- (1); | ||||||
|  | \path[draw=red,thick,->,line width=2pt] (a) -- (2); | ||||||
|  | \path[draw=red,thick,->,line width=2pt] (a) -- (3); | ||||||
|  | 
 | ||||||
|  | \path[draw=red,thick,->,line width=2pt] (5) -- (b); | ||||||
|  | \path[draw=red,thick,->,line width=2pt] (7) -- (b); | ||||||
|  | \path[draw=red,thick,->,line width=2pt] (8) -- (b); | ||||||
|  | 
 | ||||||
|  | \end{tikzpicture} | ||||||
|  | \end{center} | ||||||
| 
 | 
 | ||||||
| \subsubsection{Hall's theorem} | \subsubsection{Hall's theorem} | ||||||
| 
 | 
 | ||||||
| \index{Hall's theorem} | \index{Hall's theorem} | ||||||
| \index{perfect matching} | \index{perfect matching} | ||||||
| 
 | 
 | ||||||
| \key{Hall's theorem} describes when a bipartite graph | \key{Hall's theorem} can be used to find out | ||||||
| has a matching that contains all nodes | whether a bipartite graph has a matching | ||||||
| in one side of the graph. | that contains all left or right nodes. | ||||||
| If both sides contain the same number of nodes, | If the number of left and right nodes is the same, | ||||||
| Hall's theorem tells us if it's possible to | Hall's theorem tells us if it is possible to | ||||||
| construct a \key{perfect matching} where | construct a \key{perfect matching} that | ||||||
| all nodes are paired with each other. | contains all nodes of the graph. | ||||||
| 
 | 
 | ||||||
| Assume that we want to construct a matching | Assume that we want to find a matching | ||||||
| that contains all left-side nodes. | that contains all left nodes. | ||||||
| Let $X$ be a set of left-side nodes, | Let $X$ be any set of left nodes | ||||||
| and let $f(X)$ be the set of their neighbors. | and let $f(X)$ be the set of their neighbors. | ||||||
| According to Hall's theorem, a such matching exists | According to Hall's theorem, a matching | ||||||
|  | that contains all left nodes exists | ||||||
| exactly when for each $X$, the condition $|X| \le |f(X)|$ holds. | exactly when for each $X$, the condition $|X| \le |f(X)|$ holds. | ||||||
| 
 | 
 | ||||||
| Let's study Hall's theorem in the example graph. | Let us study Hall's theorem in the example graph. | ||||||
| First, let $X=\{1,3\}$ and $f(X)=\{5,6,8\}$: | First, let $X=\{1,3\}$ and $f(X)=\{5,6,8\}$: | ||||||
| 
 | 
 | ||||||
| \begin{center} | \begin{center} | ||||||
|  | @ -935,18 +996,19 @@ Next, let $X=\{2,4\}$ and $f(X)=\{7\}$: | ||||||
| \end{center} | \end{center} | ||||||
| 
 | 
 | ||||||
| In this case, $|X|=2$ and $|f(X)|=1$, | In this case, $|X|=2$ and $|f(X)|=1$, | ||||||
| so the condition of Hall's theorem doesn't hold. | so the condition of Hall's theorem does not hold. | ||||||
| This means that it's not possible to form | This means that it is not possible to form | ||||||
| a perfect matching in the graph. | a perfect matching in the graph. | ||||||
| This result is not surprising, because we already | This result is not surprising, because we already | ||||||
| knew that the maximum matching in the graph is 3 and not 4. | know that the maximum matching of the graph is 3 and not 4. | ||||||
| 
 | 
 | ||||||
| If the condition of Hall's theorem doesn't hold, | If the condition of Hall's theorem does not hold, | ||||||
| the set $X$ provides an explanation why we can't form a matching. | the set $X$ provides an explanation \emph{why} | ||||||
|  | we cannot form such a matching. | ||||||
| Since $X$ contains more nodes than $f(X)$, | Since $X$ contains more nodes than $f(X)$, | ||||||
| there is no pair for all nodes in $X$. | there is no pair for all nodes in $X$. | ||||||
| For example, in the above graph, both nodes 2 and 4 | For example, in the above graph, both nodes 2 and 4 | ||||||
| should be connected to node 7 which is not possible. | should be connected with node 7 which is not allowed. | ||||||
| 
 | 
 | ||||||
| \subsubsection{Kőnig's theorem} | \subsubsection{Kőnig's theorem} | ||||||
| 
 | 
 | ||||||
|  | @ -954,23 +1016,19 @@ should be connected to node 7 which is not possible. | ||||||
| \index{node cover} | \index{node cover} | ||||||
| \index{minimum node cover} | \index{minimum node cover} | ||||||
| 
 | 
 | ||||||
| \key{Kőnig's theorem} provides an efficient way | A \key{minimum node cover} of a graph | ||||||
| to construct a \key{minimum node cover} for a | is a set of nodes such that each edge of the graph | ||||||
| bipartite graph. | has at least one node in the set. | ||||||
| This is a minimum set of nodes such that |  | ||||||
| each edge in the graph is connected to at least |  | ||||||
| one node in the set. |  | ||||||
| 
 |  | ||||||
| In a general graph, finding a minimum node cover | In a general graph, finding a minimum node cover | ||||||
| is a NP-hard problem. | is a NP-hard problem. | ||||||
| However, in a bipartite graph, | However, according to \key{Kőnig's theorem}, | ||||||
| the size of | the size of a minimum node cover | ||||||
| a maximum matching and a minimum node cover | and the size of a maximum matching is always the same | ||||||
| is always the same, according to Kőnig's theorem. | if the graph is bipartite. | ||||||
| Thus, we can efficiently find a minimum node cover | Thus, we can calculate the size of a minimum node cover | ||||||
| using a maximum flow algorithm. | using a maximum flow algorithm. | ||||||
| 
 | 
 | ||||||
| Let's consider the following graph | Let us consider the following graph | ||||||
| with a maximum matching of size 3: | with a maximum matching of size 3: | ||||||
| \begin{center} | \begin{center} | ||||||
| \begin{tikzpicture}[scale=0.60] | \begin{tikzpicture}[scale=0.60] | ||||||
|  | @ -995,7 +1053,7 @@ with a maximum matching of size 3: | ||||||
| \path[draw=red,thick,-,line width=2pt] (3) -- (6); | \path[draw=red,thick,-,line width=2pt] (3) -- (6); | ||||||
| \end{tikzpicture} | \end{tikzpicture} | ||||||
| \end{center} | \end{center} | ||||||
| Using Kőnig's theorem, we know that the size | Kőnig's theorem tells us that the size | ||||||
| of a minimum node cover is also 3. | of a minimum node cover is also 3. | ||||||
| It can be constructed as follows: | It can be constructed as follows: | ||||||
| 
 | 
 | ||||||
|  | @ -1018,19 +1076,16 @@ It can be constructed as follows: | ||||||
| \path[draw,thick,-] (4) -- (7); | \path[draw,thick,-] (4) -- (7); | ||||||
| \end{tikzpicture} | \end{tikzpicture} | ||||||
| \end{center} | \end{center} | ||||||
| For each edge in the maximum matching, |  | ||||||
| exactly one of its end nodes belongs to |  | ||||||
| the minimum node cover. |  | ||||||
| 
 | 
 | ||||||
| \index{independent set} | \index{independent set} | ||||||
| \index{maximum independent set} | \index{maximum independent set} | ||||||
| 
 | 
 | ||||||
| The set of all nodes that do \emph{not} | The nodes that do \emph{not} | ||||||
| belong to a minimum node cover | belong to a minimum node cover | ||||||
| forms a \key{maximum independent set}. | form a \key{maximum independent set}. | ||||||
| This is the largest possible set of nodes | This is the largest possible set of nodes | ||||||
| where there is no edge between any two nodes | such that no two nodes in the set | ||||||
| in the graph. | are connected with an edge. | ||||||
| Once again, finding a maximum independent | Once again, finding a maximum independent | ||||||
| set in a general graph is a NP-hard problem, | set in a general graph is a NP-hard problem, | ||||||
| but in a bipartite graph we can use | but in a bipartite graph we can use | ||||||
|  | @ -1063,22 +1118,16 @@ set is as follows: | ||||||
| \index{path cover} | \index{path cover} | ||||||
| 
 | 
 | ||||||
| A \key{path cover} is a set of paths in a graph | A \key{path cover} is a set of paths in a graph | ||||||
| that is chosen so that each node in the graph | such that each node of the graph belongs to at least one path. | ||||||
| belongs to at least one path. | It turns out that in a directed, acyclic graph, | ||||||
| It turns out that we can reduce the problem | we can reduce the problem of finding a minimum | ||||||
| of finding a minimum path cover in a | path cover to the problem of finding a maximum | ||||||
| directed, acyclic graph into a maximum flow problem. | flow in another graph. | ||||||
| 
 | 
 | ||||||
| There are two variations for the problem: | \subsubsection{Node-disjoint path cover} | ||||||
| In a \key{node-disjoint cover}, |  | ||||||
| every node appears in exactly one path, |  | ||||||
| and in a \key{general cover}, |  | ||||||
| a node may appear in more than one path. |  | ||||||
| In both cases, the minimum path cover can be |  | ||||||
| found using a similar idea. |  | ||||||
| 
 |  | ||||||
| \subsubsection{Node-disjoint cover} |  | ||||||
| 
 | 
 | ||||||
|  | In a \key{node-disjoint path cover}, | ||||||
|  | each node belongs to exactly one path. | ||||||
| As an example, consider the following graph: | As an example, consider the following graph: | ||||||
| \begin{center} | \begin{center} | ||||||
| \begin{tikzpicture}[scale=0.9] | \begin{tikzpicture}[scale=0.9] | ||||||
|  | @ -1099,7 +1148,8 @@ As an example, consider the following graph: | ||||||
| \end{tikzpicture} | \end{tikzpicture} | ||||||
| \end{center} | \end{center} | ||||||
| 
 | 
 | ||||||
| In this case, the minimum node-disjoint path cover | A minimum node-disjoint path cover | ||||||
|  | of this graph | ||||||
| consists of three paths. | consists of three paths. | ||||||
| For example, we can choose the following paths: | For example, we can choose the following paths: | ||||||
| 
 | 
 | ||||||
|  | @ -1121,18 +1171,23 @@ For example, we can choose the following paths: | ||||||
| \end{center} | \end{center} | ||||||
| 
 | 
 | ||||||
| Note that one of the paths only contains node 2, | Note that one of the paths only contains node 2, | ||||||
| so it is possible that a path doesn't contain any edges. | so it is possible that a path does not contain any edges. | ||||||
| 
 | 
 | ||||||
| Finding a path cover can be interpreted as finding | We can find a minimum node-disjoint path cover | ||||||
| a maximum matching in a graph where each node | by constructing a matching graph so that each node | ||||||
| in the original graph is represented by two nodes: | in the original graph corresponds to two | ||||||
| a left node and a right node. | nodes in the matching graph: a left and right node. | ||||||
| There is an edge from a left node to a right node, | There is an edge from a left node to a right node | ||||||
| if there is such an edge in the original graph. | if there is a such an edge in the original graph. | ||||||
| The idea is that the matching determines which | In addition, the matching graph contains a source and a sink | ||||||
| edges belong to paths in the original graph. | such that there are edges from the source to all | ||||||
|  | left nodes and from all right nodes to the sink. | ||||||
| 
 | 
 | ||||||
| The matching in the example case is as follows: | A maximum matching in the resulting graph corresponds | ||||||
|  | to a minimum node-disjoint path cover in | ||||||
|  | the original graph. | ||||||
|  | For example, the following graph contains | ||||||
|  | a maximum matching of size 4: | ||||||
| 
 | 
 | ||||||
| \begin{center} | \begin{center} | ||||||
| \begin{tikzpicture}[scale=0.9] | \begin{tikzpicture}[scale=0.9] | ||||||
|  | @ -1186,26 +1241,21 @@ The matching in the example case is as follows: | ||||||
| \end{tikzpicture} | \end{tikzpicture} | ||||||
| \end{center} | \end{center} | ||||||
| 
 | 
 | ||||||
| In this case, the maximum matching consists of four edges | Each edge in the maximum matching of the matching graph corresponds | ||||||
| that corresponds to edges | to an edge in the minimum node-disjoint path cover | ||||||
| $1 \rightarrow 5$, $3 \rightarrow 4$, | of the original graph. | ||||||
| $5 \rightarrow 6$ and $6 \rightarrow 7$ in the original graph. | Thus, the size of the minimum node-disjoint path cover is $n-c$, | ||||||
| Thus, a minimum node-disjoint path cover consists of paths | where $n$ is the number of nodes in the original graph | ||||||
| that contain these edges. | and $c$ is the size of the maximum matching. | ||||||
| 
 | 
 | ||||||
| The size of a minimum path cover is $n-c$ where | \subsubsection{General path cover} | ||||||
| $n$ is the number of nodes in the graph, |  | ||||||
| and $c$ is the number of edges in the maximum matching. |  | ||||||
| For example, in the above graph the size of the |  | ||||||
| minimum path cover is $7-4=3$. |  | ||||||
| 
 |  | ||||||
| \subsubsection{General cover} |  | ||||||
| 
 |  | ||||||
| In a general path cover, a node can belong to more than one path |  | ||||||
| which may decrease the number of paths needed. |  | ||||||
| In the example graph, the minimum general path cover |  | ||||||
| consists of two paths as follows: |  | ||||||
| 
 | 
 | ||||||
|  | A \key{general path cover} is a path cover | ||||||
|  | where a node can belong to more than one path. | ||||||
|  | A minimum general path cover may be smaller | ||||||
|  | than a minimum node-disjoint path cover, | ||||||
|  | because a node can used multiple times in paths. | ||||||
|  | Consider again the following graph: | ||||||
| \begin{center} | \begin{center} | ||||||
| \begin{tikzpicture}[scale=0.9] | \begin{tikzpicture}[scale=0.9] | ||||||
| \node[draw, circle] (1) at (0,0) {1}; | \node[draw, circle] (1) at (0,0) {1}; | ||||||
|  | @ -1216,28 +1266,58 @@ consists of two paths as follows: | ||||||
| \node[draw, circle] (6) at (2,-2) {6}; | \node[draw, circle] (6) at (2,-2) {6}; | ||||||
| \node[draw, circle] (7) at (4,-2) {7}; | \node[draw, circle] (7) at (4,-2) {7}; | ||||||
| 
 | 
 | ||||||
| \path[draw=blue,thick,->,line width=2pt] (1) -- (5); | \path[draw,thick,->,>=latex] (1) -- (5); | ||||||
| \path[draw=blue,thick,->,line width=2pt] (5) -- (6); | \path[draw,thick,->,>=latex] (2) -- (6); | ||||||
| \path[draw=blue,thick,->,line width=2pt] (6) -- (3); | \path[draw,thick,->,>=latex] (3) -- (4); | ||||||
| \path[draw=blue,thick,->,line width=2pt] (3) -- (4); | \path[draw,thick,->,>=latex] (5) -- (6); | ||||||
| \path[draw=green,thick,->,line width=2pt] (2) -- (6); | \path[draw,thick,->,>=latex] (6) -- (3); | ||||||
| \path[draw=green,thick,->,line width=2pt] (6) -- (7); | \path[draw,thick,->,>=latex] (6) -- (7); | ||||||
| \end{tikzpicture} | \end{tikzpicture} | ||||||
| \end{center} | \end{center} | ||||||
| 
 | 
 | ||||||
| In this graph, a minimum general path cover contains 2 paths, | The minimum general path cover in this graph | ||||||
| while a minimum node-disjoint path cover contains 3 paths. | consists of two paths. | ||||||
| The difference is that in the general path cover, | For example, the first path may be as follows: | ||||||
| node 6 appears in two paths. | \begin{center} | ||||||
|  | \begin{tikzpicture}[scale=0.9] | ||||||
|  | \node[draw, circle] (1) at (0,0) {1}; | ||||||
|  | \node[draw, circle] (2) at (2,0) {2}; | ||||||
|  | \node[draw, circle] (3) at (4,0) {3}; | ||||||
|  | \node[draw, circle] (4) at (6,0) {4}; | ||||||
|  | \node[draw, circle] (5) at (0,-2) {5}; | ||||||
|  | \node[draw, circle] (6) at (2,-2) {6}; | ||||||
|  | \node[draw, circle] (7) at (4,-2) {7}; | ||||||
|  | 
 | ||||||
|  | \path[draw=red,thick,->,line width=2pt] (1) -- (5); | ||||||
|  | \path[draw=red,thick,->,line width=2pt] (5) -- (6); | ||||||
|  | \path[draw=red,thick,->,line width=2pt] (6) -- (3); | ||||||
|  | \path[draw=red,thick,->,line width=2pt] (3) -- (4); | ||||||
|  | \end{tikzpicture} | ||||||
|  | \end{center} | ||||||
|  | And the second path may be as follows: | ||||||
|  | \begin{center} | ||||||
|  | \begin{tikzpicture}[scale=0.9] | ||||||
|  | \node[draw, circle] (1) at (0,0) {1}; | ||||||
|  | \node[draw, circle] (2) at (2,0) {2}; | ||||||
|  | \node[draw, circle] (3) at (4,0) {3}; | ||||||
|  | \node[draw, circle] (4) at (6,0) {4}; | ||||||
|  | \node[draw, circle] (5) at (0,-2) {5}; | ||||||
|  | \node[draw, circle] (6) at (2,-2) {6}; | ||||||
|  | \node[draw, circle] (7) at (4,-2) {7}; | ||||||
|  | 
 | ||||||
|  | \path[draw=red,thick,->,line width=2pt] (2) -- (6); | ||||||
|  | \path[draw=red,thick,->,line width=2pt] (6) -- (7); | ||||||
|  | \end{tikzpicture} | ||||||
|  | \end{center} | ||||||
| 
 | 
 | ||||||
| A minimum general path cover can be found | A minimum general path cover can be found | ||||||
| almost like a minimum node-disjoint path cover. | almost like a minimum node-disjoint path cover. | ||||||
| It suffices to extend the matching graph | It suffices to add some new edges to the matching graph | ||||||
| so that there is an edge $a \rightarrow b$ | so that there is an edge $a \rightarrow b$ | ||||||
| always when there is a path from node $a$ to node $b$ | always when there is a path from $a$ to $b$ | ||||||
| in the original graph (possibly through several edges). | in the original graph (possibly through several edges). | ||||||
| 
 | 
 | ||||||
| The matching graph for the example case looks as follows: | The matching graph for the above graph is as follows: | ||||||
| \begin{center} | \begin{center} | ||||||
| \begin{tikzpicture}[scale=0.9] | \begin{tikzpicture}[scale=0.9] | ||||||
| \node[draw, circle] (1a) at (0,6) {1}; | \node[draw, circle] (1a) at (0,6) {1}; | ||||||
|  | @ -1327,17 +1407,17 @@ The matching graph for the example case looks as follows: | ||||||
| \index{Dilworth's theorem} | \index{Dilworth's theorem} | ||||||
| \index{antichain} | \index{antichain} | ||||||
| 
 | 
 | ||||||
| \key{Dilworth's theorem} states that the size of | An \key{antichain} is a set of nodes of a graph | ||||||
| a minimum general path cover in a directed, acyclic graph | such that there is no path | ||||||
| equals the maximum size of an \key{antichain}, i.e., | from any node to another node | ||||||
| a set of nodes such that there is no path | using the edges of the graph. | ||||||
| from any node to another node. | \key{Dilworth's theorem} states that | ||||||
|  | in a directed acyclic graph, the size of | ||||||
|  | a minimum general path cover | ||||||
|  | equals the size of a maximum antichain. | ||||||
| 
 | 
 | ||||||
| For example, in the example graph, the minimum | For example, nodes 3 and 7 form an antichain | ||||||
| general path cover contains two paths, | in the following graph: | ||||||
| so the largest antichain contains two nodes. |  | ||||||
| We can construct such an antichain |  | ||||||
| by choosing nodes 3 and 7: |  | ||||||
| 
 | 
 | ||||||
| \begin{center} | \begin{center} | ||||||
| \begin{tikzpicture}[scale=0.9] | \begin{tikzpicture}[scale=0.9] | ||||||
|  | @ -1358,9 +1438,7 @@ by choosing nodes 3 and 7: | ||||||
| \end{tikzpicture} | \end{tikzpicture} | ||||||
| \end{center} | \end{center} | ||||||
| 
 | 
 | ||||||
| There is no path from node 3 to node 7, | This is a maximum antichain, because it is not possible | ||||||
| and no path from node 7 to node 3, | to construct any antichain that would contain three nodes. | ||||||
| so nodes 3 and 7 form an antichain. | We have seen before that the size of a minimum | ||||||
| On the other hand, if we choose any three | general path cover of this graph consists of two paths. | ||||||
| nodes in the graph, there is certainly a |  | ||||||
| path from one node to another node. |  | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue