Consider a question to find a minimum dominating set of an interval graph. In the context of interval scheduling, it is converted to the question below:
There are multiple intervals which may or may overlap with each other. Find a minimum subset of the intervals, so that for every interval that is not included in the subset, it will find at least 1 interval in the subset that will overlap with it.
There is an agreed greedy solution available from various sources on the Internet, such as one solution from Cornell: http://www.cs.cornell.edu/Courses/cs4820/2011sp/handouts/samplesolutions.pdf
We work to fill up a set C which makes up the committee (subset of intervals). We use a set M to hold ’covered’ intervals for bookkeeping.
- Sort the intervals by finish time with earliest finish time first.
- Take the interval i in S with earliest finish time.
- Construct set O = {s ∈ S|s intersects i}
- Take o ∈ O with the latest finish time and add o to C, add all the intervals that intersect with o to M
- repeat 2-4 until all intervals are covered.
This is similar to a voted up answer provided by interjay in 2012 on SO: Find the smallest set of overlapping jobs
But I have noticed a counterexample that proves the above solution does not produce the minimum subset:
Consider intervals: [0,2], [1,4], [3,10], [5, 6], [7,8], [9, 10].
A minimum subset should have 2 intervals: [3, 10] plus either [0, 2] or [1, 4].
But the above solution will return a subset of 4 intervals: [1,4], [5,6], [7,8] and [9,10]. The longest interval [3,10] was prematurely rejected at step 4.
Is there a better greedy solution than the ones posted above? Thanks!