4.3.2 Refinement of the staircase We keep the intersection staircase as an ordered list of right upper corners of the corresponding rectangles r (t'). First we describe how rectangles from P(t) influence the intersection staircase. We consider all the rectangles of P(t) and how they intersect the staircase. On this behalf, we sort the lower left corners ai of the rectangles pi according to the difference between y- and x-coordinates and process the rectangles in this ordering. Clearly, all those corners lie to the left of the left boundary of r (t). Assume that we have already processed the corners a1,..., ai-1 as well as the topmost j steps of the staircase with j ≥ 0. Let s(tj) be the actual step defined by rectangle r (tj) to be considered. We consider pi. If pi is below of the diagonal of r (tj), it can be neglected since it has been considered while processing r (tj). Otherwise, if the lower boundary intersects step s(tj), the upper part of s(tj) is cut off, and we proceed to Pi+1. If the lower boundary is even lower than the whole step, s(tj) is completely cut off, and we proceed to s(tj+1). In this case, we reconsider pi (see Fig. 8). Figure 8 The basic intersection staircase shown in grey must be refined since there are rectangles like Pi ∈ Pr(t) and r ∈ Rr(t) which have not been considered before in the runs for t' and which reduce the basic intersection staircase such that a lower staircase shown in darkgrey remains. Hence for the computation of the maximal cliques regarding t we have to reduce the area of the upper half only by the refined staircase. Clearly, since there are at most n points pi and steps s(tj), the whole process takes O(n log n). Analogously, we can refine the intersection staircase by considering the rectangles in Q(t), which have not been considered in the staircase-defining rectangles r (t'). For rectangles in R (t), the refinement is slightly different, so we will consider this in more detail: The intersection staircase now separates the area representing cliques that have not been computed before from those which either have been computed before or which have not been assigned yet. Hence we only move the intersection staircase downwards! The intersection staircase consists of a list of points c1,...,ck which are not necessarily corners of rectangles, but at least they can uniquely be assigned to rectangles r (t') ∌ Pr(t) ⋃ Qr(t) ∈ Rr(t). Assume that these points are ordered with decreasing y-coordinates. We denote the corresponding diagonals t1,...,tk analogously. First we state an important observation: Lemma 5 Only rectangles r (t') which are part of the intersection staircase have maximal diagonals. Hence the non-maximal r (t') that is not in P(t) ⋃ Q(t) ⋃ R (t) does not need to be considered. The elements of Rr(t) are similarly ordered according to the difference between y- and x-coordinate of their left lower corner. The idea is that when comparing a rectangle r (t') from the staircase with an element s from Rr(t) then the staircase should not be changed if s intersects t'. Otherwise, the intersection of s must be cut off from the staircase. More formally, we start with the topmost step of the staircase and let t' be the corresponding diagonal. Let smax be the first element in the ordered list from Rr(t). If the left lower corner is below t', then smax has been considered already in the computation of the maximal cliques regarding t'. Hence it can be disregarded and it does not change the staircase. We can delete smax from the list and let the next element be smax. If the left lower corner of smax is above t', we compute the intersection of smax with the actual step of the staircase, and remove it either completely or only partially depending on the size of the intersection. In the first case, we proceed to the next lower step of the staircase while in the second case, we remove smax from the list and get a new smax. In all cases, the operation can be done in O(1) time, and in total we have only O(n) operations. This concludes the description how we effectively restrict the area of r (t) to be considered for computation of just those maximal cliques which have not been computed before. Hence we can summarize the whole section by Theorem 1 In time O(n2 log n + out) we can determine all maximal cliques in c-max-tolerance graphs. Note that the naive bound of O(n4) for out can be improved to O(n3) by writing down only the differences between subsequent maximal cliques. This is supported by the above methods to determine the maximal cliques in a plane sweep approach.