public static int mst(Edge[] vertices, int nodeCount) {
		int max = Integer.MIN_VALUE;
		
		Tree[] trees = new Tree[nodeCount];
		for (int i = 0; i < nodeCount; i++) {
			trees[i] = new Tree(i);
		}
		for (int i = 0; i < vertices.length; i++) {
			Edge edge = vertices[i];
			if (trees[edge.from].getNum() != trees[edge.to].getNum()) {
				trees[edge.to].setParent(trees[edge.from]);
				max = edge.weight;
			}
			if (i % (nodeCount) == 0) {
				boolean stop = true;
				int val = trees[0].getNum();
				for (Tree tree : trees) {
					if (tree.getNum() != val) {
						stop = false;
						break;
					}
				};
				if(stop) break;
			}
		}
		return max;
	}