From bf0fdd735acd7d7c0ba5b090f930a0716fd44524 Mon Sep 17 00:00:00 2001 From: MarcosVillacanas Date: Mon, 6 Jul 2020 13:00:35 +0200 Subject: [PATCH] Context added --- DataStructures/Graphs/Kruskal.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/DataStructures/Graphs/Kruskal.java b/DataStructures/Graphs/Kruskal.java index 58b8d89eb..82fdf3912 100644 --- a/DataStructures/Graphs/Kruskal.java +++ b/DataStructures/Graphs/Kruskal.java @@ -1,4 +1,9 @@ -package Kruskal; +//Problem -> Connect all the edges with the minimum cost. +//Possible Solution -> Kruskal Algorithm (KA), KA finds the minimum-spanning-tree, which means, the group of edges with the minimum sum of their weights that connect the whole graph. +//The graph needs to be connected, because if there are nodes impossible to reach, there are no edges that could connect every node in the graph. +//KA is a Greedy Algorithm, because edges are analysed based on their weights, that is why a Priority Queue is used, to take first those less weighted. +//This implementations below has some changes compared to conventional ones, but they are explained all along the code. +//In case you need to know anyhing else, I would be willing to answer all your doubts, you can contact me by https://www.linkedin.com/in/marcosvillacanas/ import java.util.Comparator; import java.util.HashSet;