@Override
	public int[] sort() {
		// TODO Auto-generated method stub
		List<Integer> sorted = new LinkedList<Integer>();
		Color[] color = new Color[size];
		for(int i = 0; i < size; ++i) {
			color[i] = Color.WHITE;
		}
		for(int i = 0; i < size; ++i) {
			try {
				visit(color, i, sorted);
			} catch(Exception e) {
				return null;
			}
		}
		int[] s = new int[size];
		for(int i = 0; i < sorted.size(); ++i) {
			s[i] = sorted.get(i);
		}
		return s;
	}