The Proof of Correctness of Prim's Algorithm
来源:互联网 发布:双色球彩神通软件 编辑:程序博客网 时间:2024/06/05 18:09
Let P be a connected, weighted graph.
At every iteration of Prim's algorithm,
an edge must be found that connects
a vertex in a subgraph to a vertex
outside the subgraph. Since P is
connected, there will always be a
path to every vertex. The output Y
of Prim's algorithm is a tree, because
the edge and vertex added to tree Y
are connected. Let Y1 be a minimum
spanning tree of graph P. If Y1=Y then
Y is a minimum spanning tree. Otherwise,
let e be the first edge added during the
construction of tree Y that is not in
tree Y1, and V be the set of vertices
onnected by the edges added before
edge e. Then one endpoint of edge
e is in set V and the other is not.
Since tree Y1 is a spanning tree of
graph P, there is a path in tree Y1
joining the two endpoints. As one
travels along the path, one must
encounter an edge f joining a vertex
in set V to one that is not in set V.
Now, at the iteration when edge e
was added to tree Y, edge f could
also have been added and it would
be added instead of edge e if its
weight was less than e (we know
we encountered the opportunity
to take "f" before "e" because "f" is
connected to V, and we visited every
vertex of V before the vertex to
which we connected "e" ["e" is
connected to the last vertex we
visited in V]). Since edge f was
not added, we conclude that
ω(f)≥ω(e)
Let tree Y2 be the graph obtained
by removing edge f from and
adding edge e to tree Y1. It is
easy to show that tree Y2 is connected,
has the same number of edges as
tree Y1, and the total weights of its
edges is not larger than that of tree Y1,
therefore it is also a minimum spanning
tree of graph P and it contains edge
e and all the edges added before it
during the construction of set V.
Repeat the steps above and we will
eventually obtain a minimum
spanning tree of graph P that is
identical to tree Y. This shows
Y is a minimum spanning tree.
- The Proof of Correctness of Prim's Algorithm
- Proof of Cover's Function Counting Theorem
- The power of algorithm
- Burden of Proof
- Proof of Fibonacci Nim
- Proof of Wythoff Game
- POC(proof-of-concept)
- POC(proof-of-concept)
- Question 17: Which of the following identify const-correctness failures in the C++ program below?
- Proof of the deliverables - 完成品的证明
- codechef Correctness of Knight Move题解
- A proof of an equation
- Proof of work - 工作量证明
- Proof of work - 工作量证明
- Proof of work - 工作量证明
- POD – Proof of Delivery
- Dijkstra's Algorithm of shortest path
- Illustrating the generic search algorithm: Search for first occurrence of deque's contents as a subs
- socket实现ping命令(控制台)
- MAXCC的值
- 输入10个正数,求最大值、最小值、平均值。
- Android自动化测试初探
- SQL的简单查询实例教程
- The Proof of Correctness of Prim's Algorithm
- dash 和 bash 的 一点区别
- Android自动化框架API,方案及分析
- c++ string详解 c_str()
- Server Application Error解决方法
- 文字倒序输出
- Linux 远程登录 Windows 主机
- CodeForces Round #121 (191A) - Dynasty Puzzles
- DISP参数