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