1 parent c3aae55 commit b0a6a52Copy full SHA for b0a6a52
3 files changed
src/com/zejian/structures/Graph/WeightGraph/LazyPrimMST.java
@@ -12,6 +12,8 @@
12
* 利用深度优先搜索算法遍历图,并标记已被访问过的顶点,同时利用最小堆的特性
13
* 每一次切分,都将新的边的权值加入堆中,并获取从其中获取最小权值的元素,必
14
* 为最小生成树的一条边的权值
15
+ *
16
+ * 时间复杂度 E * LogE(deleteMin方法执行的总时间复杂度) + E * LogE(visit方法执行的总时间复杂度) = E*LogE级别
17
*/
18
public class LazyPrimMST<Weight extends Number & Comparable<Weight>> {
19
private boolean visited[]; //标记已被访问过的顶点
src/com/zejian/structures/Graph/WeightGraph/TestMainForPrim.java
@@ -0,0 +1,5 @@
1
+package com.zejian.structures.Graph.WeightGraph;
2
+
3
+public class TestMainForPrim {
4
5
+}
testWG1.txt
@@ -0,0 +1,17 @@
+8 16
+4 5 .35
+4 7 .37
+5 7 .28
+0 7 .16
6
+1 5 .32
7
+0 4 .38
8
+2 3 .17
9
+1 7 .19
10
+0 2 .26
11
+1 2 .36
+1 3 .29
+2 7 .34
+6 2 .40
+3 6 .52
+6 0 .58
+6 4 .93
0 commit comments