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 869d048

Browse files
Update README.md
1 parent 608664d commit 869d048

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

‎README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,11 @@ It produces this Minimum Spanning Tree
2020

2121
- Requires **distinct nodes named with consecutive integers**. If they really **do** have the same "name", convert them to integer ID's to use this algorithm
2222
Example graph has 8 nodes numbered 1-8 (array ignores the 0th index)
23-
- **You must hardcode the graph structure in constructor** as a **list of edges**
24-
- `graphEdges` is **indexed from 1** to make it more human-readable. In the constructor:
25-
`graphEdges=new ArrayList<Edge>();` //creates empty ArrayList
26-
`graphEdges.add(new Edge(0, 0, 0));` //adds dummy edge before any actual edges
27-
**The 0th index is ignored because the loop starts @ 1**
28-
- `DisjointSet nodeSet = new DisjointSet(nodeCount+1);` also skips the 0th index by creating a Disjoint Set **1 larger than the number of nodes**
23+
- **Graph is created as an Edge List**
2924
- **Make sure `nodeCount` is accurate**. There's no error checking between `nodeCount` & the actual edge list
25+
- `DisjointSet nodeSet = new DisjointSet(nodeCount+1);` skips the 0th index by creating a Disjoint Set **1 larger than the number of vertices**
3026
- `outputMessage` is a string that records the steps the algorithm takes. It's printed to the screen & to a file once complete
31-
- My implementation has **early termination**. If a graph has **N nodes** the MST has **(N-1) edges**
27+
- My implementation has **early termination** (A Spanning Tree of a graph has **N-1** edges so the algorithm stops whenn it has added **N-1** Edges)
3228
Hence `&& mstEdges.size()<(nodeCount-1)` in my loop
3329
- The `Edge` class simply packages an edge's weight & 2 vertices together as 1 object
3430

0 commit comments

Comments
(0)

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