private void algo(String root) {
    Vertex rootVertex = graph.getVertex(root);

    Set<Vertex> vertices = graph.getVertices();
    if(rootVertex != null) {
      for(Vertex v : vertices) {
        v.setKey(INFINITY);
        v.setParent(null);
      }
      rootVertex.setKey(0);
    }

    minWeightVertices.addAll(vertices);
    System.out.println(minWeightVertices);
    Set<Vertex> mst = new LinkedHashSet<>();
    mst.add(rootVertex);
    while(!minWeightVertices.isEmpty()) {
      System.out.println("\t\t\t All vertices :" + graph.getVertices());
      System.out.println("\t\t\t Before poll  :" + minWeightVertices);
      Collections.sort(minWeightVertices);
      Vertex u = minWeightVertices.remove(0);
      System.out.println("\t\t\t After poll   :" + minWeightVertices);

      for(Vertex v : graph.getAdjacentVertices(u)) {
        int edgeWeight = graph.getWeight(u, v);
        if(minWeightVertices.contains(v) && edgeWeight < v.getKey()) {
          v.setParent(u);
          v.setKey(edgeWeight);
          mst.add(v);
        }
      }
    }
    System.out.println(mst);
  }