MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / minKey

Method minKey

Programs/PrimsAlgorithm.java:14–26  ·  view source on GitHub ↗
(int key[], Boolean mstSet[])

Source from the content-addressed store, hash-verified

12 // A utility function to find the vertex with minimum key
13 // value, from the set of vertices not yet included in MST
14 int minKey(int key[], Boolean mstSet[])
15 {
16 // Initialize min value
17 int min = Integer.MAX_VALUE, min_index = -1;
18
19 for (int v = 0; v < V; v++)
20 if (mstSet[v] == false && key[v] < min) {
21 min = key[v];
22 min_index = v;
23 }
24
25 return min_index;
26 }
27
28 // A utility function to print the constructed MST stored in
29 // parent[]

Callers 1

primMSTMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected