Fast Algorithms To Partition Simple Rectilinear Polygons*

Two algorithms to partition hole-free rectilinear polygons are developed. One has complexity ∼ O(kn) and the other O(n log k) where n is the number of vertices in the polygon and k is the smaller of the number of vertical and horizontal inversions of the polygon, k is a measure of the simplicity of a polygon. Since k is small for most practical polygons, our algorithms are fast in practice. Experimental results comparing our algorithms with that of Imai and Asano [1] are also presented.


INTRODUCTION
ectilinear polygons (Figure 1) arise frequently in VLSI layout and artwork analysis, computer graphics, databases, image processing, etc. ( [2], [3], [4], [5], [6]).The functions performed on rectilinear polygons are often more easily performed using either a rectangle partition or a rectangle cover.In either case the rectilinear polygon is decomposed into a set of rectangles whose union is the original rectilinear polygon.If this set of rectangles is dis- jointed it is a partition.In a cover the rectangles need not be disjoint.
A minimal nonoverlapping cover (MNC) of rec- tilinear polygon P is a rectangle partition of P that contains the fewest possible number of rectangles.Ohtsuki  [7] has developed an O(n5/2) algorithm to find the MNC of a rectilinear polygon with n vertices.
Imai and Asano [1] have developed an O(n 3/2 log n) algorithm to find the MNC and Liou, Tan, and Lee [8] have an O(n log log n) algorithm for hole-free rectilinear polygons.The algorithm of [8] is not ex- pected to perform better than that of [1] as it uses *This research was supported, in part, by the National Science Foundation under grants MIP 86-17374 and MIP-9103379.finger search trees that are known to be impractical ("Finger search trees are sufficiently complicated that one would probably not want to use them in an actual implementation", pg. 165of [9]).
Nahar and Sahni [10] introduced a complexity measure for hole-free rectilinear polygons.They de- fined the number of horizontal inversions, kH, to be the minimum number of changes in horizontal di- rection during a walk around the polygon divided by 2. For example if we walk around the polygon of Figure l(a) beginning at vertex W so that the interior is to our left, and we first walk right up to vertex X, then left up to vertex Y, then right up to Z, and then left up to W. The direction of horizontal motion changes at W, X, Y, Z. So, kH 2. For the polygon of Figure 2(a) k, 5.The number of vertical in- versions, kv, is defined analogously, kv 1 for the polygons of Figures l(a) and 2(a).The inversion BACKGROUND MNC Algorithm of [7] We assume that the rectilinear polygon is oriented so that its vertical edges are parallel to the y-axis and its horizontal edges are parallel to the x-axis.Two vertices (x, Yl) and (x2, y2) are cohorizontal (co- vertical) if yl Y2 (x x2).A vertex is convex (concave) if the interior angle made by the two edges incident at this vertex is 90 (270).A chord is a line segment that lies wholly within the polygon and joins two cohorizontal or two covertical concave vertices.
A set of chords is independent if no two chords of the set intersect.Chords are used to generate an MNC of a rectilinear polygon.Since the MNC is a rectilinear partition, we may restrict ourselves to hor- izontal and vertical chords.
Example 1: Consider the hole-free polygon of Fig- ure 2(a).Some of the cohorizontal vertex sets are (r, q), (p, o), (t, s, m, n), and (v, u, l, k).Some of the covertical vertex sets are (z, a'), (w, v), and (t, u, x, y).Some of the convex vertices are a, b, d, f, and g.And some of the concave vertices are c, e, h, and i.The complete set of horizontal chords is {sm, ul, ix, hb', el'}, and the complete set of vertical chords is {ux, sb', c'f', pc, il}.Notice that both horizontal and vertical chords are always independent.The chords sm and sb' are not independent, as they in- tersect at s.The MNC algorithm of [7] uses the following three steps" Step 1: Find a maximum independent set of chords (i.e., a maximum cardinality set of independent chords).
Step 2: Draw the chords in this maximum inde- pendent set.This partitions the polygon into smaller rectilinear polygons.
Step 3: From each of the concave vertices from which a chord was not drawn in step 2 draw a maximum length vertical line that is wholly within the smaller rectilinear polygon created in step 2 that contains this vertex.
In step 3 we may draw horizontal lines or vertical ones.The rectangles formed by the polygon edges, chords of step 2 and lines of step 3 form an MNC [7].
Example 2: The chord set {ux, li, sm, hb', ef'} is a maximum independent chord set for the polygon of  The rectangles in the MNC are numbered 1 through 10.
The complexity of steps 2 and 3 of the algorithm of [7] is O(n log n) where n is the number of vertices in the rectilinear polygon.A simple sweep line al- gorithm can be used for this.We concentrate on step 1.A maximum independent chord set may be found [7] by first setting up a bipartite graph G (H tO V, E) where each vertex in H represents a horizontal chord and each vertex in V represents a vertical chord.There is an edge between two vertices if the chords they represent intersect (i.e., cross or meet).
Figure 4 shows the bipartite graph for the polygon of Figure 2(a).The problem of finding a maximum independent chord set now becomes one of finding a maximum independent vertex set (MIS) in a bi- partite graph (two vertices are independent if there is no edge between them).
A maximum independent vertex set of a bipartite graph is related to a maximum matching by the fol- lowing theorem.Theorem 1: [11] Let G (H U V, E) be a bipartite graph.Let M be a maximum matching of G and let F be the set of free vertices relative to this matching (i.e., F contains all vertices of G that are not matched in M).

MI.
(b) There is an MIS S of G such that F C_ S and for every edge (v, h) M exactly one of v and h is in S. Using the above theorem one may obtain the al- gorithm of Figure 5 to construct an MIS S for a maximum matching M [12].
c'f' is added to S.
One may easily verify that procedure MaxInd con- structs an independent set of cardinality ]H + Ivl [M[.From Theorem 1 it follows that this is an MIS.
Step 1 of Ohstuki's algorithm [7] is imple- mented as" Step la: Find a maximum matching of the bipar- tite graph that represents the chords.
Step lb: Find a maximum independent chord set using the maximum matching of Step la and procedure MaxInd.
Procedure MaxInd(G,M,S); {Given a bipartite graph G = ( HwV, E) and a maximum matching M _ Ohtsuki used the O(n5/2) bipartite graph matching algorithm of Hopcroft and Karp [13] for Step la.
Since the remaining steps take less time than this, Ohtsuki's implementation has complexity O(rts/2).Imai and Asano [1] have developed an O(n 3/2 log n) algorithm to find a maximum matching of the inter- section graph of horizontal and vertical line seg- ments.This results in an 0(/73/2 log n) implementa- tion of Ohtsuki's method to find an MNC.Maximum

Matching In Convex Bipartite Graphs
The neighborhood, NEB(x), of a vertex x is defined to be the set of vertices adjacent to vertex x.For the bipartite graph of Figure 4, NEB(hl) {v2, v3} and NEB(v) {h2, h3}.A bipartite graph G (H U V, E) is convex on V if the vertices in V can be ordered such that for every h H, NEB(h) [FIRST(h), LAST(h)] (i.e.all vertices in the ordering beginning at vertex FIRST(h) and going on to vertex LAST(h)) or null.Convex on H can be defined similarly.The bipartite graph of Figure 4 is convex on H as NEB(v,) {h2, h3} [h:, h].

NEB(vs) {hs} [hs,
A vertex x is matchable if there is a vertex y NEB(x) such that NEB(y) C_ NEB(z) for all z NEB(x).Vertex hi of Figure 4 is matchable as NEB(hl) {v2, v3} and NEB(v2) C_ NEB(z) for all z NEB(h).The importance of a matchable vertex x is that we can show that there is a maximum match- ing M that contains (x, y).
Theorem 2: Let x be a matchable vertex in a graph G. Let y be such that y NEB(x) and NEB(y) C_ NEB(z) for all z NEB(x).There is a maximum matching that contains the edge (x, y).
Proof: Let M' be a maximum matching of G that does not contain the edge (x, y).Since M' is a max- imum matching and (x, y) is an edge of G, both x and y cannot be free relative to M'.If only x is free then (y, w) M' and we can construct M M' {(y, w)} U {(x, y)}.If only y is free then (x, a) M' and we construct the maximum matching M M' {(x, a)} tA {(x, y)}.If neither x nor y is free then (x, a) M' and (y, w) M'.Since a NEB(x), NEB(y) C_ NEB(a).Now since w NEB(y), w NEB(a).So, (w, a) is an edge of G. From M', we may construct the maximum matching M M' {(x, a), (y, w)} U {(x, y), (w, a)}.
[ Theorem 2 leads us to formulate the following strategy to find a maximum matching: Step 1: If G has no edges then stop.
Step 2: If G has no matchable vertex then fail and stop.
Step 3: Select a matchable vertex x and a vertex y as in Theorem 2. Add (x, y) to M. Delete x, y, and all edges incident to x and y from G.
It is evident that a maximum matching is found so long as we do not have a failure termination in Step 2. Graphs which do not cause the preceding strategy to fail are called matchable graphs.For a bipartite graph G (H U V, E) that is convex on V and in which V {v, v2 vnv} is ordered as required by the convex property the above strategy to find a maximum matching takes the form given in procedure MaxMatch (Figure 6).This procedure is due to [12].Step 2 has been eliminated as for any iteration of the for loop if NEB(vi) O then for every h NEB(vi), NEB(h) [vi, LAST(h)].By the choice of h., NEB(h) C_ NEB(h) for every h NEB(vi).So, vertex vi is matchable and by Theorem 2 (h., v;) may be added to M. As a result of this we may conclude that every bipartite graph that is convex on V is matchable.
Starting with a maximum matching, the MIS of a bipartite graph that is convex on V can be obtained in O(n/ + nv)time where n/ ]H and nv IV.
For this we use a strategy slightly different from that used in procedure MaxInd (Figure 4).We assume that the maximum matching M is obtained by using procedure MaxMatch (Figure 6) and that the vertices in V are ordered as required by the convexity prop- erty and those in H are ordered so that FIRST(hi) <-FIRST(h/+ 1).
The strategy in the new independent set algorithm is to begin by placing all vertices in V into the MIS S that is being constructed.From Theorem 1 we know that there is an MIS that contains all free ver- tices and exactly one vertex from each pair of matched vertices in M. To construct such an inde- pendent set, we examine the free vertices that are also in H (all free vertices in V are already in S).They are examined in order (i.e. if hi and h are free and < j then h; is examined before hi).When a free vertex hi is examined, it is added to S. To ensure that the vertices in S are still independent we need to examine the V vertices in the range [FIRST(h), LAST(h;)].These must be eliminated from S. Each vertex v in this range must be in the matching M as hi is free and M is maximal.If v is matched to hq in Procedure MaxMatch(G,M); G = ( HwV, E) is a bipartite graph that is convex on V. V = {v , v,, is ordered as required by the convex property.A maximum matching M is computed.begin M := for i := 1 to nv do if NEB(v) then begin Let h e n be such that LAST(h)) = min {LAST(h)} h NEB () M :=M tO {(hy, vi)}; Delete h, v, and incident edges from G; end end; of if & for end; of MaxMatch FIGURE 6 Maximum matching algorithm of [12].
An examination of procedures MaxMatch and MaxIndl reveals that an MIS of a convex bipartite graph G (H tO V, E) can be found in O(nH + nv) time if we can do the following in this much time: a) Compute FIRST(hi) and LAST(hi), 1 -< -< b) For each v; V with NEB(vi) -f0 compute h/ NEB(vO such that LAST(hi) min,u/o,) {LAST(h)} (Procedure MaxMatch).

--O(kn) MNC ALGORITHM Preliminaries
If the vertices of a polygon edge are both convex (concave) the edge is called a support edge (reflex edge).A polygon edge is a left, right, top, or bottom edge if the polygon interior is to its right, left, bot- tom, or top, respectively.The edges vw, za', and 200 SAN-YUAN WU and SARTAJ SAHNI Procedure Maxlndl (G,M,S); G = ( HuV, E) is a bipartite graph that is convex on V. M is a matching produced by procedure MaxMatch.This procedure constructs an MIS S of G.It is assumed that the vertices in V are ordered as required by the convexity property and that FIRST(h) < FIRST(h+), 1 < < nn begin Initialize a stack so that it contains the single interval [l, r] = [-,,0, _,,o]; S := V; all vertices of V initially in S} for each free vertex hi in order do begin Add h to S; if NEB(hi) Q then begin low := FIRST(hi); high := LAST(hi); [l, r] := interval at top of stack; repeat if <_ high <_ r then begin delete [l, r] from top of stack; high := 1; {bypass already processed interval} low := min l, low}; set [l, r] to new top of stack interval; end else begin delete v from V; if v is a matched vertex in M then begin Let hq be the vertex it is matched to; add hq tO S; low := min low, FIRST(hq) }; {Note: high is not to be updated as LAST(hq) < LAST(h/)} end; {if matched high := high-1; end; disjoint from the interval at top of stack} until (high < low); Add [low, LAST(h)] to top of stack; end; of if NEB(hi) e end; {of for each free vertex h} end; of MaxInd I FIGURE 8 Maximum independent set algorithm of [12].
d'e' of the polygon of Figure 2(a) are left support edges and edges xy and b'c' are left reflex edges.Theorem 4: Let P be a rectilinear hole-free polygon with horizontal and vertical inversion numbers k, and kv respectively.The following are true.
(a) k, number of right support edges plus num- ber of left reflex edges.number of left support edges plus num- ber of right reflex edges.
(b) kv number of top support edges plus num- ber of bottom reflex edges.number of bottom support edges plus number of top reflex edges.
(c) For each of the four sides left, right, top, and bottom, the number of reflex edges is one less than the number of support edges. (d) k. number of vertical support edges minus one.
(e) kv number of horizontal support edges mi- nus one.
Proof: (a) A walk around the polygon changes from right to left only at a right support edge and at a left reflex edge.Since the number of right to left changes equals the number of left to right changes, the total horizontal direction changes on a complete walk around the polygon is 2 * (number of right support edges plus number of left reflex edges).So ku number of right support edges plus number of left reflex edges.The equality kt number of left support edges plus number of right reflex edges is obtained in a similar way.(b) can be proved anal- ogously.
We shall prove (c) by induction on the number n of vertices in P. Let lse and lre denote the number of left support edges and left reflex edges, rse, bse, tse, rre, bre, and tre are defined analogously.We explicitly show lse lre 1.The proof for the other three sides is similar.
For the induction base, we have n 4. When n 4, P has one left support edge and no left reflex edge.So, lse lre= 1. Assume lse lre 1 for all hole-free rectilinear polygons with n -< m vertices where m is an arbitrary natural number >_4.Let P be any rectilinear hole-free polygon with n m + 1 vertices.P has at least one left support edge.Pick any one of P's left support edges and move this right- wards until this edge aligns with the first left or right edge encountered.Figure 9 gives the cases that can arise.For each case the primed quantities represent values for the polygon that remains following the elimination of the portion of the polygon crossed during the movement of the left support edge.In cases (j) through (t) crop' gives the number of re- suiting hole-free polygons.This number is 1 for cases (a) through (i).In case (a) the number of vertices decreases by 4 as vertices a, b, c, and d are no longer polygon vertices following the movement of the sup- port edge ab to the position cd.So, n' n 4, lse' lse, lre' lre.From the induction hypothesis, lse' Ire' 1. So, Ise -lre 1.As another example, consider case (j).The resulting h / 1 polygons have a total of n 4 vertices.Applying the induction hypothesis to each and summing, we get lse' -lre' h / 1.So, lse-lre-lse' h lre'-1.Using the induction hypothesis, we can show that for each of the remaining cases of Figure 9, lse -lre 1.
(e) is obtained in a similar way.k=l In this section we develop an O(n) algorithm to find the MNC of a rectilinear hole-free polygon with in- version number k 1.We explicitly consider only the case k k, 1.The case k kv i is handled in an analogous manner.
Since every rectilinear polygon has at least one left support edge and one right support edge, it follows from Theorem 4(a) that when kt 1 the number of vertical reflex edges is zero.As a result the polygon cannot have two vertical chords with the same x- coordinate.Consequently there is a unique left to right ordering of the vertical chords.Let the vertical chords, in this ordering, be vl, v2, v,,,.This ordering may be obtained in O(n) time by starting at the two vertices of the single left support edge (Theorem 4) of the polygon and moving right.Dur- ing this walk we match top vertices with bottom ones to see if a vertical chord can be drawn here.Since the polygon contains no holes and no vertical reflex edges, NEB(hi) for every horizontal chord hi is an interval of the vertical chords.The horizontal chords may be constructed and their FIRST and LAST val- ues computed by making a left to right pass over the top and bottom boundaries of the polygon.During this pass the horizontal chords may also be ordered by their FIRST-value.The total time needed for this is O(n).
Procedure MaxMatch examines the vertical chords left to right.Suppose that the neighborhood, NEB, of a vertical chord is maintained as a doubly linked list sorted on the y coordinate.Since NEB(v;) cannot contain two horizontal chords with the same y co- ordinate, this ordering is well defined.The doubly linked list can be initialized in O(1) time.As we go from one v to the next additions and deletions of horizontal chords is localized in the doubly linked list and can be done in time proportional to the num- ber of affected chords, h is the horizontal chord in the doubly linked list that has the least right end point.Since the polygon has no right reflex edge, this must either be the horizontal chord with lowest or highest y coordinate.I.e., it is one of the chords at the two ends of the doubly linked list that rep- resents NEB.So, h can be found in O(1) time and deleted from the list.Figure 10 illustrates this tech- nique.The MIS is now found using procedure Ire" Ire O) Maxlndl.From the above discussion it follows that the MNC of a hole-free rectilinear polygon with k 1 can be found in O(n) time. k=2 We explicitly consider only the case k k, 2.
The case k kv 2 is similar.From Theorem 4(d)   it follows that a polygon with k, 2 satisfies one of the following: (a) lse 2, rse 1.
Since (b) is symmetric to (a), we consider only (a) further.From Theorem 4(a) it follows that lre= 1.
If the single left reflex edge is extended in one di- n'=n-4 lse'= lse + h lre" Ire cmp'=h+ 1  (j) n'=n-4 lse'= lse + h 1 Ire" Ire 1 cmp'=h+ 1 (s) Ire" =lre 1 cmp=h+ 1 (0 rection until it meets a horizontal edge (see Figure 11) then the polygon is divided into two parts P1 (left of the reflex extension) and P2.Both P and P2 have k kH 1.This partitioning into P1 and P2 may be done by beginning at the bottom of the left reflex edge and moving around the polygon until reaching the x-coordinate of this left reflex edge.Once P1 and P. have been identified, their vertical chords can be numbered left to right as for the case k 1 (see previous section).In each case, numbers are assigned beginning with the number 1. Horizontal chords that span both P and P2 will have two FIRST and LAST values associated with them; one being the first and last vertical chord of P1 they intersect and the other being the first and last vertical chord of P2 that is intersected.Since there are no right reflex edges, the A maximum matching of horizontal and vertical chords is obtained as follows: (1) Begin at the leftmost vertical chord of P1 and proceed left to right as for the case k 1.A doubly linked list of intersecting horizontal chords ordered by y-coordinate is maintained as in the case k 1.When each vertical chord is examined in this order, it is a matchable chord.This follows from the observation that since P has no right reflex edge, the neigh- borhood of the intersecting horizontal chord with smallest right end point is contained in the neighborhood of every other intersecting horizontal chord.Furthermore, the absence of a right reflex edge implies that the intersecting horizontal chord with the smallest right end point is either at the front or the end of the doubly linked list (i.e., it is either the one with the highest or the lowest y-coordinate).This matching of vertical chords of PI to horizontal chords terminates when the right boundary of Pl is reached.The doubly linked list of hori- zontal segments is saved.
(2) Begin with the leftmost vertical chord of P2 and proceed left to right matching horizontal and vertical chords as in (1).Stop when the left to right sweep reaches the left reflex edge.To the doubly linked list of horizontal seg- ments append the doubly linked list saved in (1) and continue the left to right matching sweep.
The above two step process results in a maximum matching, as when a vertical chord is matched it is a matchable chord (Theorem 2).
To compute the MIS we use the strategy used in the case k 1. I.e., we begin with all vertices of V (both in P1 and P2) in the independent set and then process the free horizontal chords.The stack scheme of MaxIndl is replaced by union-find structures [14] for each of P1 and P2.For each of P and P2 we maintain a set of equivalence classes of vertical chords in Pl and P2, respectively.Each equivalence class represents an interval of processed vertical chords.A free horizontal chord that is in both P and P2 needs to be processed in both polygons.The complexity of the resulting scheme is O(nc(n, n)) where c is the inverse of the Ackermann's function [14].
k=3 From Theorem 4 we see that one of the following must be true: (a) lse 3, rse 1.(b) lse rse 2. (c) lse 1, rse 3. Since (a) and (c) are symmetric we need only con- sider (a) and (b).reflex edge and has two left reflex edges (Theorem 4(a)).By extending the two left reflex edges at one end each we can decompose the polygon into three polygons with k 1.Since there is no right reflex edge we can find the maximum matching by extend- ing the strategy of k 2 to the case when P is partitioned into three polygons with k 1 each.We first match the chords in P1 and then continue to P2.The matching in P2 commences at its leftmost vertical chord.When the processing reaches the right bound- ary of P, the doubly linked list saved from P is appended and we continue till the right boundary of P. is reached.Now we start matching in P3.The processing begins at the leftmost vertical chord in P3.When the right boundary of P2 is reached, the doubly linked list saved at the end of the processing of P2 is appended and we continue up to the rightmost ver- tical chord in P3.The correctness of this scheme is established in the same way as we established the correctness of the k 2 scheme.
When lse rse 2 the polygon has one right reflex edge and one left reflex edge.The partitioning into P, P2, and P3 is done as follows: (1) Determine the number of vertical support edges encountered in a walk that begins at the top of the right reflex edge and ends at the top of the left reflex edge.The walk follows the polygon edges but does not go over the reflex edges.This latter restriction uniquely specifies the walk.
(2) The number of vertical support edges encoun- tered in the above walk is either 0, 2, or 4. If the number is 0, then extend both reflex edges downward (Figure 12(d)).If the number is 2, then extend the right reflex edge upward and the left reflex edge downward in case the bot- tom of the right reflex edge is at a higher y- coordinate than the top of the left reflex edge

12(e)).
A maximum matching of vertical chords to horizontal chords is obtained as follows: (1) [Number of vertical support edges in walk is 0 (Figure 12(d))].
(a) Match chords in P using the strategy of k 1.However, P is processed right to left.Stop when the left boundary of P1 is reached.Horizontal chords of P1 that ex- tend into P3 are now processed.If the chord was matched to a vertical chord of P1, it is marked as matched.If it was not matched, its right end point is changed to be the left boundary of P.
(b) Match chords in P2 left to right using the strategy of k 1. Stop when the right boundary of P2 is reached and save the doubly linked list of horizontal chords.
(c) Match chords in P3 left to right.Already matched horizontal chords are ignored from the processing.When the right boundary of D is reached, the doubly linked list saved when the processing of P2 finished is appended to the current doubly linked list.
The correctness of the above matching strategy fol- lows from the following observations: (a) When a vertical chord is examined, it is a matchable chord.
(b) If this vertical chord is in P, then it may be matched to the horizontal intersecting chord with maximum left end point.This is either the bottom most or topmost intersecting chord.
(c) If it is a vertical chord of P2, it can be matched to the horizontal intersecting chord with the smallest right end point.
(d) If it is a P vertical chord, it is to be matched to the horizontal intersecting chord that is as yet unmatched and has smallest right end point.Since all vertical chords of P that could be matched to a horizontal chord have already been matched, the right end points of un- matched horizontal chords that extend into P may be considered to be the left boundary of P.This does not affect the set of free vertical chords each such horizontal chord intersects. (2)[Number of vertical support edges in walk is 2 and the bottom of the right reflex edge is above the top of the left reflex edge, (Figure (a) Match chords in P1, left to right, using the strategy of k 1. Stop when the right boundary of P is reached and save the doubly linked list of free horizontal chords that extend into P3.(b) Match the chords in P2, right to left, using the strategy of k 1. Stop when the left boundary of P2 is reached.Mark the matched horizontal chords of P2 that ex- tend into P3 as matched.Change the right end points of the unmatched horizontal chords of P2 that extend into P3 to be the left boundary of P2.(c) Match the chords in P3 left to right.When the right boundary of P is reached, ap- pend the saved doubly linked list.
The fact that this strategy results in a maximum matching may be established in a manner analogous to that used for case (1).The strategies for the re- maining two cases (Figures 12(c) and (e)) are similar.
The MIS is now found in O(nc(n, n)) time using MaxIndl and union-find structures for each of P, P2, P..
We explicitly consider only the case k k/.The strategy is to decompose the polygon into 2k sub- polygons with kH 1 and then use the matching strategy to each of these in a suitable order.The decomposition is easily done by extending the ver- tical reflex edges in both directions (Figure 13(a)).This takes O(n log k) time if a range search tree [15] is used to store the end points of the at most k 1 vertical reflex edges.The resulting polygons have no left or right reflex edges.From Theorem 4(c) it fol- lows that each polygon has lse rse 1.From Theorem 4(d) it follows that k/ 1 for each polygon.
In order to apply the strategy of k 1 (or its modification to a right to left sweep) to a subpolygon, the following must be true at the time the matching in the subpolygon begins: (1) The subpolygon should contain no vertical re- flex edge.
(2) Either all subpolygons that abut it on the left or all that abut it on the right must have been  processed.In case the former is true, the sub- polygon is processed left to right; otherwise it is processed right to left.
(3) The subpolygon should not contain two un- matched horizontal chords such that one passes on one side of a vertical reflex edge and the other passes on the other side of this reflex edge.For this test, the current end points of chords are used.Recall from k 3 that when a subpolygon is processed right to left the right end points of some chords are updated.Sim- ilarly, we assume, that when a subpolygon is processed left to right, the left end points are updated to become the right boundary of the subpolygon.
Note that since the subpolygons are constructed by extending all vertical reflex edges, all of them satisfy condition (1).So we need only be concerned with conditions (2) and (3).For condition (2), we can maintain, with each subpolygon, a count of the number of unprocessed subpolygons that abut it on the left and the number that abut it on the right.Also, with each subpolygon we maintain a list of the subpolygons it abuts on the left as well as on the right.When a subpolygon is processed, this list is traversed and the left abut and right abut counts of the subpolygons on this list are decremented.For condition (3), we maintain a constraint graph CG.This is a bipartite graph with one vertex for each subpolygon and one for each vertical reflex edge.There is an edge between a subpolygon vertex and a reflex edge vertex if both ends of the reflex edge can be joined to the interior of the subpolygon by a horizontal line that is wholly within the polygon.Subpolygon vertices with degree zero in the con- straint graph and which satisfy condition (2) above can be processed first in any order.So these are added to the front of the order being constructed.These subpolygons may be deleted from the original polygon to get the polygon of Figure 13(c).Since the deletion of each subpolygon reduces the number of vertical reflex edges by 1, the new polygon has fewer reflex edges than the original one.A new constraint graph for this polygon is constructed (Figure 13(d)) and the subpolygons with degree zero that also satisfy condition (2) above are added to the order being constructed.So, so long as the constraint graph has a subpolygon vertex of degree zero that also satisfies condition (2), we can repeat this process to obtain the desired order.For the example of Figure 13(a) we obtain the order P3, P6, P7, Ps, P1, P2, P4, and P,.The following theorem shows that every con- straint graph has at least one subpolygon vertex whose degree is zero and for which its current left abut or right abut count is also zero.
Theorem 5: The constraint graph of every rectilin- ear hole-free polygon (whether original or updated) has at least one subpolygon vertex with degree zero and such that the corresponding subpolygon has a left or right abut count of zero.
Proof: Without loss of generality, assume that lse >-rse.Since rse rre + 1 (Theorem 4(c)), it follows that lse > rre.The number of subpolygons one of whose sides is a left support edge of the polygon is lse.Each right reflex edge can be connected to at most one of these in the constraint graph.Since lse > rre, at least one of these left support edge sub- polygon vertices is not connected to a right reflex edge vertex in the constraint graph.Further, no left support edge subpolygon vertex can be connected to a left reflex edge vertex.Hence there is at least one left support edge subpolygon vertex with degree zero.Every subpolygon, constructed as described above, that has a left support edge has a left abut count of zero.
Using the above strategy and appropriate data structures a maximum matching can be found in O(kn) time.The MIS can be found in O(kn oz(n, n)) time using Maxlndl and union-find structures.
O(n log k) ALGORITHM This algorithm is an adaptation of the O(n log log n) MNC algorithm of [8].This latter algorithm has the following steps" Step 1: Step 2" Step 3: Step 4: Decompose the rectilinear polygon P into vertically convex subpolygons.This de- composition is done in such a way that a maximum matching of chords can be found by processing the subpolygons in the order in which they are created.Process the subpolygons in the order cre- ated to obtain a maximum matching.Free chords from each subpolygon are added to a queue in the order in which they are determined to be free by the maximum matching algorithm.Obtain an MIS of chords by processing the maximum matching and free chord queue obtained in Step 2. Draw the independent chords in the in- dependent set of Step 3 to get a set of subpolygons.Draw all vertical chords in the resulting subpolygons to get rectan- gles.
Step 3 can be done in O(n) time [8] and Step 4 takes O(n log k) time.We show how steps 1 and 2 can be done in O(n log k) time.We consider the case k kv.The case k kn is similar.The basic strategy is to start at any horizontal support edge and advance into the polygon (i.e., if we start at a bottom support edge, then we move upwards and if we start at a top support edge, we move downwards) until we reach either a vertical or horizontal reflex edge.This is done by moving along the contour of the polygon beginning at the horizontal support edge.The moving is done in both directions keeping the y-coordinate of the position in both directions the same (this is the same as using a horizontal scan line with endpoints on the polygon contour identified by Consider the polygon of Figure 15(a).Suppose we begin at the horizontal support edge ss2.Since this is a bottom support edge, we set next top and move a horizontal scan line upwards from ss2.Vertices a, b, and c, the bottom ends of vertical reflex edges, are encountered in order and subpolygons P, P2, and P3 are added to SP in this order.Next, the scan line reaches a horizontal reflex edge.We stop processing and resume at another horizontal support edge. Figure 15(b) shows the current situation.Sub- polygons P, P2, and P3 have been eliminated and the hatched area indicates a region of the polygon that has been scanned.Suppose we pick the bottom support edge s3s4.next is set to top and we advance upwards.The vertical reflex edges with vertices d, e, and f at the bottom endsare found.As a result, subpolygons P, Ps, and P6 are added to the queue Going on to Figure 15(c), the horizontal support edge sss6 is picked and subpolygon P7 is appended to SP. Next, we pick the top support edge SyS8 and set next bottom (Figure 15(d)).No subpolygon is generated in this area.Then, another top support edge SgSo is considered and we move down until a horizontal reflex edge is encountered (Figure 15(e)).
Then, we turn the direction 3 times, down to up, up to down, and down to up, respectively (Figure 15(f)).No subpolygon is added to SP as no vertical reflex edge is encountered.Finally, the top support edge ss2 is handled (Figure 15(g)).The subpolygons P8 and P9 are added to SP before a horizontal reflex is found.
(g) (h) (0 FIGURE 15 The subpolygons P0 and P are appended to SP when we turn around from going down to up and complete the whole procedure Decompose (Figure 15(h)).The remaining vertical convex polygon P12 is added to SP (Figure 15(i)).
Step 2 can actually be done concurrently with Step 1.The strategy of kn 1 can be used to obtain a maximum matching and the queue of free chords in O(n) time.
Step 3 is now implemented as in [8] and Step 4 is the same as that used for the algorithm of "--O(kn) MNC.

EXPERIMENTAL RESULTS
We programmed three algorithms for the MNC prob- lem.These are: 1. O(n log k)...The algorithm of the preceding section.
2. --O(kn)...This uses the algorithms described for k 1, 2, and 3, respectively.For k > 3, it uses the decomposition scheme of the preceding section and the independent set strategy of k > 3. We did not use the decomposition scheme of k > 3 as preliminary tests indicated it was slower than that of the preceding section.
3. O(n 5 |og n) This is the algorithm of [1].size All algorithms were programmed in Pascal and run on an Apollo DN3500 workstation.Tables I-V give the average run times, in seconds, of the three pro-   grams for the case of randomly generated rectilinear polygons with k 1, 2, 3, 5, and 10, respectively.(Rectilinear polygons were generated randomly and then classified according to their k value.)The col- umn labeled size gives the number of vertices in the polygon.For each value of size, 50 random polygons were generated.The columns labeled improve (%) give the amount by which the run time of the O(n log n) algorithm exceeds this algorithm's run time.As can be seen, for any fixed k, the O(n log k) and ---O(kn) programs outperform the O(n 5 log n) pro- gram for suitably large polygons.The percentage im- provement in run time increases as the polygon size increases.For k 1, and 2, the --O(kn) program is faster than the O(n log k) program.For k 3, these two programs are quite competitive and for k > 3 the O(n log k) program is superior.

CONCLUSIONS
We have developed two algorithms to obtain the MNC of rectilinear polygons with small k.Both are significantly faster than the O(n 5 log n) algorithm of [1] on polygons whose size is large relative to k.
For k 1 and 2 the -O(kn) algorithm is recom- mended while for k > 2 the O(n log k) algorithm is recommended.

FIGURE 2
FIGURE 2 MNC of a rectilinear polygon.

FIGURE 3
FIGURE 3 Distribution of polygons by number of vertices.

Figure 2 (
Figure 2(a).Figure 2(b) shows the polygon after the chords in this set are drawn.Figure 2(c) shows the polygon after vertical lines are drawn as in Step 3.

Figure 2 (
Figure 2(a).Figure 2(b) shows the polygon after the chords in this set are drawn.Figure 2(c) shows the polygon after vertical lines are drawn as in Step 3.

1 / 4 V
Intersection graph of chords of polygon in Figure

FIGURE 7
FIGURE 7 Apply Maxlndl to a convex (on V) bipartite graph.
Figure 12(a) gives an example for lse 3 and rse 1 while Figures 12(b), (c), (d), and (e) are examples for the case lse rse 2. When Ise 3 and rse 1 the polygon has no right

FIGURE 12
FIGURE 12 Example polygons with k k.3.

(
Figure 12(b)); otherwise extend the right re- flex edge downward and the left reflex edge upward (Figure12(c)).If the number is 4, then extend both reflex edges upward(Figure
SP. Processing stops when the next horizontal reflex edge is reached.It resumes at a new horizontal sup- port edge.

Table
VI gives the measured run time for the UNISYS polygon set.The O(n log k) and --O(kn) programs outperformed the O(n 5 log n) one for polygons with no more than 40 vertices.The O(n 5 log n) program was slightly faster for the larger polygons in this test set.