private Vertex generateMst(ArrayList<Dist> dists, int nodesSize) {

		Vertex neighbours[] = new Vertex[nodesSize];
		for (short i = 0; i < nodesSize; i++)
			neighbours[i] = new Vertex(i);

		int vertexCount = 0;
		for (Dist dist : dists) {
			if (vertexCount == nodesSize - 1)
				break;

			Vertex a = neighbours[dist.a];
			Vertex b = neighbours[dist.b];

			if (a.isAlreadyDistantNeighbourTo(b))
				continue;

			a.addNeighbour(b);
			vertexCount++;

		}

		// for (Vertex vertex : neighbours) {
		// System.out.println(vertex);
		// }

		return neighbours[dists.get(0).a];
	}