Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d62a8b5

Browse files
2 parents 0b23b20 + 9d63760 commit d62a8b5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Kruskal's Algorithm Minimum Spanning Tree (Graph MST)
22

33
Java Implementation of Kruskal's Algorithm using **disjoing sets**
4-
**Kruskal's algorithm:** Start with T = ∅. Consider edges in ascending order of weight. Insert edge e into T unless doing so would create a cycle
4+
**Kruskal's algorithm:** Start with **T** = ∅. Consider edges in ascending order of weight. Insert edge `e` into **T** unless doing so would create a cycle.
55
- Works on **UN-directed** graphs
66
- **Algorithm still works on edges with identical weight**
77
Edges are sorted by weight first. Depending on the order they are entered into the **edge list** in the **constructor**, you may get different Minimum Spanning Trees (but all still optimal solutions)
88

9-
##PseudoCode
9+
##PseudoCode
1010
![kruskal-pseudocode](https://cloud.githubusercontent.com/assets/15304528/23335535/450deca2-fb85-11e6-9fd6-ce146ddb3471.png)
1111

12-
##Detailed Implementation
12+
##Detailed Implementation
1313
![kruskal-detailed-implementation](https://cloud.githubusercontent.com/assets/15304528/23335531/3ef5b4da-fb85-11e6-9d9d-01318c793a3c.png)
1414

15-
##Code Notes
15+
##Code Notes
1616
Current code runs on this sample graph
1717
![graph](https://cloud.githubusercontent.com/assets/15304528/23335398/0971bd4c-fb83-11e6-9390-3c3d10d524c3.png)
1818
It produces this Minimum Spanning Tree
@@ -32,6 +32,6 @@ Example graph has 8 nodes numbered 1-8 (array ignores the 0th index)
3232
Hence `&& mstEdges.size()<(nodeCount-1)` in my loop
3333
- The `Edge` class simply packages an edge's weight & 2 vertices together as 1 object
3434

35-
####Sources
35+
####Sources
3636
- [Disjoint Sets by Mark Allen Weiss](http://users.cis.fiu.edu/~weiss/dsaajava3/code/DisjSets.java) Author of *Data Structures and Algorithm Analysis in Java (3rd Edition), 2011*
3737
He also has other helpful [Java Data Structures implementations](http://users.cis.fiu.edu/~weiss/dsaajava3/code/)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /