Let me just explain some definition before going to the problem:
Say point A is a coordinates(that could have double value), say (1.2,3.5,4.3,2.6),
same to point B.
A point A dominates point B,
iff
1. all coordinates in point A <= all coordinates in point B, and
2. one coordinate of point A < corresponding coordinates of point B
For example:
Given
A=(2,3,4,5)
B=(2,3,4,6)
A dominates B since condition 1 holds, and for condition 2, the forth component of A < forth component of B.
Given another example,
A=(2,3,4,5)
B=(2,3,4,5)
Neither A dominates B, and vice versa, since condition 2 does not hold in both cases.
Now given a list of coordinate of n dimension, I wish to find the set of coordinates that are not dominated by others,
these coordinates are termed as skyline set.
Say I have coordinates in 5 dimensions
(2,1,2,1,2)
(1,2,1,2,1)
(3,3,3,3,3)
(4,4,4,4,4)
The skyline set is
(2,1,2,1,2)
(1,2,1,2,1)
Now I wish to write a function:
List<double[]> SkylineSet(List<double[]> Coordinates, int dimension)
Given example input:
List<double[]> newList=new List<double[]>();
newList.Add(new double[] {2, 1, 2, 1, 2});
newList.Add(new double[] { 1, 2, 1, 2, 1 });
newList.Add(new double[] { 3, 3, 3, 3, 3 });
newList.Add(new double[] { 4, 4, 4, 4, 4 });
SkylineSet(newList,5) will output
(2,1,2,1,2)
(1,2,1,2,1)
This could be achieved by pairwise comparison of each coordinates, but the
number of coordinates can be very large, any one has idea how to solve this efficiently?
Put the points in a K-D tree (or some such data structure). Now, You can efficiently find points dominated by a given point. Remove those that got dominated, repeat for all remaining points.