public static boolean isConnected(List<Interval> list, Interval i1,
			Interval i2) {
		Vector<Vector<Integer>> adjList = new Vector<Vector<Integer>>();
		Interval interval1, interval2;
		Vector<Integer> tempList;

		// Build adjacency list
		for (int i = 0; i < list.size(); i++) {
			interval1 = list.get(i);
			tempList = new Vector<Integer>();
			for (int j = 0; j < list.size(); j++) {
				if (i == j) {
					continue;
				}

				interval2 = list.get(j);

				if (interval1.getBeginMinuteUnit() <= interval2
						.getEndMinuteUnit()
						&& interval1.getEndMinuteUnit() >= interval2
								.getBeginMinuteUnit()) {
					tempList.add(j);
				}
			}
			adjList.add(tempList);
		}

		// Breadth First Search
		LinkedList<Integer> queue = new LinkedList<Integer>();
		int[] visited = new int[list.size()];

		int index1, index2;
		index1 = list.indexOf(i1);
		index2 = list.indexOf(i2);

		queue.offer(index1);

		int currIndex;
		while (!queue.isEmpty()) {
			currIndex = queue.poll();
			if (visited[currIndex] != 1) {
				for (int i = 0; i < adjList.get(currIndex).size(); i++) {
					queue.offer(adjList.get(currIndex).get(i));
				}

				visited[currIndex] = 1;
			}
		}

		if (visited[index2] == 1) {
			return true;
		}

		return false;
	}