:: wikimiki.org ::
| 最小生成树 |
最小生成树在一給定的無向圖 G = (V, E) 中,(u, v) 代表連接頂點 u 與頂點 v 的邊(即 ),而 w(u, v) 代表此邊的權重,若存在 T 為 E 的子集(即 )且為無循環圖,使得
:
的 w(T) 最小,則此 T 為 G 的最小生成樹。
最小生成樹其實是最小權重生成樹的簡稱。
以有線電視電纜的架設為例,若只能沿著街道佈線,則以街道為邊,而路口為頂點,其中必然有一最小生成樹能使佈線成本最低。
性質
- 最小生成樹的邊數必然是頂點數減一,|E| = |V| - 1。
- 最小生成樹不可以有循環。
- 最小生成樹不必是唯一的。
演算法
Prim演算法與Kruskal演算法是尋找最小生成樹的經典方法,兩者皆為貪進法,通常使用二元堆積,時間複雜度為 。若使用費伯納西堆積,Prim演算法可加速至 。
安全邊
Prim演算法與Kruskal演算法使用貪進法時有著相似的思維:一次「生成」一條「安全邊」,如下所示:
GENERIC-MST-FUNCTION (G,w)
1 T := 空集合
2 while T 還不是生成樹
3 do 找出對 T 來說是「安全」的邊 (u, v)
4 T := T U
5 return T
Category:圖演算法
category:数据结构
樹 (圖論)在图论中,树是任意两个顶点间有且只有一条路径的图。森林是任意两个顶点间至多有一条路径的图。
定义
如果一个无向简单图G是一棵树,必须满足这个条件:
G是连通图,而且没有简单环。如果在G中加入一条边,就会有一个环。如果在G中断开一条边,就不会连通。G中的任意两个顶点能被唯一的简单路径连接。
如果G有有限个顶点,(设为n个顶点),还满足以下条件:
- G是连通的,有n-1条边,并且G没有简单环。
如果一个无向简单图G中没有简单环,那么G是森林。
例子
有6个顶点和5条边的树
树的类型
- 自由树
- 有根树
- 有向树
- 二叉树
- 满二叉树
- 完全二叉树
- Positional tree
- 空树
category:图论
ja:木 (数学)
th:ต้นไม้ (ทฤษฎีกราฟ)
Prim演算法Prim演算法用於解決最小生成樹問題,基本步驟如下:
# 任選一頂點作為一子樹的根節點
# 將所有的邊依照權重放入優先權佇列
# 在佇列中尋找能與子樹中頂點連接的最輕邊並加入之
# 重覆前一步直到所有頂點皆包含在此子樹中
參考
Prim演算法與Dijkstra演算法的策略相似。
Category:圖演算法
貪進法贪心法(Greedy algorithm)是一种在每一步选择中都采取在当前状态下最好/优的选择,从而希望导致结果是最好/优的算法。贪心法可以解决一些最优性问题,如:求图中的最小生成树、求哈夫曼编码……对于其他问题,贪心法一般不能得到我们所要求的答案。一旦一个问题可以通过贪心法来解决,那么贪心法一般是解决这个问题的最好办法。由于贪心法的高效性以及其所求得的答案比较接近最优结果,贪心法也可以用作辅助算法或者直接解决一些要求结果不特别精确的问题。
Category:代数 Category:算法
費伯納西堆積 |
在计算机科学中,斐波纳契堆是最小堆有序树的集合。它和二项式堆有类似的性质。
结构
斐波纳契堆中的树都是有根的但是无序。每个节点x包含指向父节点的指针p[x]和指向任意一个子结点的child[x]。x的所有子节点都用双向循环链表链接起来,叫做x的子链表。子链表中的每一个节点y都有指向它的左兄弟的left[y]和右兄弟的right[y]。如果节点y是x仅有的子节点,则left[y]=right[y]=y。
操作
建立一个新的斐波纳契堆
插入一个节点
查找最小的节点
合并两个斐波纳契堆
释放最小的节点
Category:數據結構
Prim演算法Prim演算法用於解決最小生成樹問題,基本步驟如下:
# 任選一頂點作為一子樹的根節點
# 將所有的邊依照權重放入優先權佇列
# 在佇列中尋找能與子樹中頂點連接的最輕邊並加入之
# 重覆前一步直到所有頂點皆包含在此子樹中
參考
Prim演算法與Dijkstra演算法的策略相似。
Category:圖演算法
Kruskal演算法(一) Kruskal算法的操作及原理
Kruskal算法共四个步骤:
1. 新建图G,G中拥有原图中相同的节点,但没有边
2. 将原图中所有的边按权值从小到大排序
3. 从权值最小的边开始,如果这条边连接的两个节点于图G中不在同一个连通分量中,则添加这条边到图G中
4. 重复3,直至图G中所有的节点都在同一个连同分量中
这样的步骤保证了选取的每条边都是桥,因此图G构成一个树。为什么这一定是最小生成树呢?关键还是步骤3中对边的选取。
算法中总共选取了n-1条边,每条边在选取的当时,都是连接两个不同的连通分量的权值最小的边,要证明这条边一定属于最小生成树,可以用反证法:
如果这条边不在最小生成树中,它连接的两个连通分量最终还是要连起来的,通过其它的连法,那么另一种连法与这条边一定构成了环,而环中一定有一条权值大于这条边的边,用这条边将其替换掉,图仍旧保持连通,但总权值减小了。也就是说,如果不选取这条边,最后构成的生成树的总权值一定不会是最小的。
(二) Kruskal算法的实现
KRUSKAL-FUNCTION(G, w)
1 F := 空集合
2 for each 圖 G 中的頂點 v
3 do 將 v 加入森林 F
4 所有的邊依權重 w 遞增排序
5 for each 邊
6 do if u 和 v 不在同一棵子樹
7 then F := F U
8 將 u 和 v 所在的子樹合併
category:圖演算法
Mustafa MohamedMustafa Mohamed, Mustafa Hassan Mohamed, född 1 mars 1979 i Somalia, svensk friidrottare, 3000 m hinder, bosatt i Lysekil. Tävlar för Hälle IF.
Meriter
- Vann Lidingöloppet 27 september 2003 och 25 september 2004.
- 13:e plats på 3000 m hinder i Olympiska sommarspelen 2004 i Aten.
- Vann Göteborgsvarvet i maj 2004.
- 10:e plats på 3000 m hinder i VM i friidrott 2005
Mohamed, Mustafa
Mohamed, Mustafa
zasony litera h jastrzbia gra tapety motorola Hotele w Warszawie
|
|
| :: RELATED NEWS :: |
Daisy World
Daisyworld, a computer simulation, is a hypothetical world orbiting a sun whose temperature is slowly increasing in the simulation. Daisyworld was introduced by James Lovelock and Andrew Watson to illustrate the plausibility of the Gaia hypothesis in a paper published in Read More... |
Not-for-profit arts organization
A not-for-profit arts organization is usually in the form of a not-for-profit corporation, association, or foundation. They are formed for the purpose of developing and promoting the work of artists in various visual and performing art forms such as
|
Tugboat
This article is about the boat. For the journal of digital typography, see TUGboat. For alternative meanings of tug, see Tug (disambiguation).
Tug (disambiguation)
A tugboat, or tug, is a ship used to manoeuvre, primarily by towing, other vessels (see shipping) in harbours, over th
|
Oleomargarine
Margarine is a generic term used to indicate any of a wide range of butter substitutes. In many parts of the world, margarine is now the best selling table spread, although butter and olive oil also command large market shares. It is used as an ingredient in the preparation of many other foods. Margarine is commonly called butter in informal speech, but (at least in the United States) food packaging is not permitted to refer to margarine as "butter". R
|
Electric street car
:For other meanings of tram, see tram (disambiguation).
tram (disambiguation), Finland]]
Finland. It delivers parts to the Transparent Factory]]
A tram (tramcar, trolley, or streetcar) is a railborne vehicle, lighter than a train, designed fo
|
Dynamo
Dynamo can refer to more than one item. See the following for more options.
- For electrical references see Electrical generator
- For the comic character see Dynamo (comics)
- Operation Dynamo was the name of the mass evacuation at Dunkirk 1940.
- A J2EE application server from [http://www.atg.com ATG]
- The Dynamo Open Air is a major American English) or boyband (British English) is a style of pop group featuring between three and six young male singers who are usually also dancers. They also sing R&B songs as well and sometimes hip-hop. Often, they evolve out of church choral groups,
|
Gasoline carburettor
The carburetor (American spelling, carburettor or carburetter in Commonwealth countries, "carb" for short, or "carbie" (slang)) is a device which mixes air and fuel for an internal-combustion engine. Carburetors are still found in small engines and in older or specialized automobiles such as those designed for
|
Mohammed Mossadegh
Dr. Mohammed Mossadegh (Persian: محمد مصدق) (May 19, 1882 - March 4, 1967) was prime minister of Iran from 1951 to
|
Rheinland
The Rhineland (Rheinland in German) is the general name for the land on both sides of the river Rhine in the west of Germany. A geographical term originally, it has also acquired some political and cultural connotations, becoming a political entity as the Prussian Rhine Province (also known as Rhenish Prussia), and continuing in the names of the German s
|
|