public int kargerRandomMinCut() {
		int retval = 0;
		while (graphMatrix.keySet().size() > 2) {
			// printMergedNodes();
			// Integer[] vertexArray = (Integer[])
			// graphMatrix.keySet().toArray();
			ArrayList<Integer> vertexArray = new ArrayList<Integer>(
					graphMatrix.keySet());
			int randomVertexIndex = (int) (Math.random() * (vertexArray.size()));
			int randomVertex = vertexArray.get(randomVertexIndex);

			HashMap<Integer, Integer> neighborTable = graphMatrix
					.get(randomVertex);
			ArrayList<Integer> neighborArray = new ArrayList<Integer>(
					neighborTable.keySet());
			int randomNeighborIndex = (int) (Math.random() * (neighborArray
					.size()));
			int randomNeighbor = neighborArray.get(randomNeighborIndex);

			// System.out.println("VerticeArraylen=" + vertexArray.size()
			// + " neighborArrayLen=" + neighborArray.size());
			// System.out.println("vertex=" + randomVertex + " neighbor="
			// + randomNeighbor);

			shrinkByEdge(randomVertex, randomNeighbor);
			// System.out.println("------------------------------------");
		}

		// when only two elements left in array, they're essentially A,B, print
		// A and B, and the number of crossing edges between them
		Iterator<Integer> it = graphMatrix.keySet().iterator();
		while (it.hasNext()) {
			int vertex = it.next();
			HashMap<Integer, Integer> neighbor = graphMatrix.get(vertex);

			// System.out.print(vertex + ":");
			Iterator<Integer> innerIt = neighbor.keySet().iterator();
			while (innerIt.hasNext()) {
				int neighborVertex = innerIt.next();
				int edgeCount = neighbor.get(neighborVertex);
				retval = edgeCount;
				// System.out.print("(" + neighborVertex + "," + edgeCount +
				// ")");
			}

			// LinkedList<Integer> nodes = mergedNodes.get(vertex);
			// if (nodes != null) {
			// System.out.print("[");
			// for (int i : nodes) {
			// System.out.print(i + ",");
			// }
			// System.out.println("]");
			// } else {
			// System.out.println("null!!");
			// }
		}
		return retval;
	}