Dynamic Maintenance of Half-Space Depth for Points and Contours

Half-space depth (also called Tukey depth or location depth) is one of the most commonly studied data depth measures because it possesses many desirable properties for data depth functions. The data depth contours bound regions of increasing depth. F…

Authors: Michael A. Burr, Eynat Rafalin, Diane L. Souvaine

Dynamic Maintenance of Half-Space Depth for Points and Contours
D YNAMIC MAINTENANCE OF HALF-SP A CE DEPTH F OR POINTS AND CONTOURS MICHAEL A. BURR, EYNA T RAF ALIN, AND DIANE L. SOU V AINE Abstract. Half-space depth (also called T uk ey depth or lo cation depth) is one of the most c ommonly studied data d epth measures because it possesses many desirable prop erties for data depth functions. The data depth con tours b ound regions of increasing dept h. F or the sample c ase, there are t wo competing definitions of con tours: the rank-based con tours and the c ov er-based con tours. In this paper, we present three dynamic algorithms f or mai ntaining the half- space depth of p oints and con tours: The first mai ntains the half- s pace depth of a single p oint in a data set in O (log n ) tim e p er up date (insertion/deletion) and ov erall linear s pace. By maintaining such a data structure f or each data point, we presen t an algorithm for dynamically maintaining the rank-based con tours i n O ( n · log n ) time p er update and ov erall qua dratic space. The third d ynamic algori thm maintains the cov er-based c onto urs in O ( n · log 2 n ) time p er update and ov erall quadratic space. W e also augment our first algorithm to maintain the lo cal co ver-based con- tours at data p oints whil e maintaining the same complexities. A coroll ar y of this discussion is a strong structural result of independent i n terest describing the b eha vior of dynamic cov er-based contou rs near data p oi n ts. Key wor ds: Data depth, Half-sp ac e depth, Dynamic algorithm, Data struc- tur e 1. I ntroduction Data depth is a statistical a nalysis metho d that assig ns a depth value to a point x ∈ R d that measures how deep (or central) x is r elative to a pr obability dis- tribution or to a data set (see surveys [Aloupis, 2006; L iu et al., 1 999]). Data depth has recently attracted attention from the computational geometry commu- nit y [Liu et al., 20 06]. It do es not require a priori assumptions on the underlying probability distr ibution of da ta and handles observ ations that deviate from the data (outliers). H alf-sp ac e depth , first defined b y [T ukey, 197 5; Ho dges, 1955], is a data depth measure that has been commonly studied in re cent years, e.g., [Liu et al., 1999; B remner et al., 2 008; Aloupis et al., 2002; Miller et al., 2003]. Depth c on- tours are nested contours that enclose regio ns of increasing depth [T ukey, 197 5]. They provide a p owerful to ol to visualize , quan tify , and co mpare da ta sets (e.g., [Liu et al., 199 9; Rousseeu w et al., 1999]). The statistics communit y has produced t wo comp eting definitions for depth con tours, yielding distinctive contours. The t wo main approa ches were termed c over a nd r ank [Rafalin and Souv a ine, 200 4], see Figure 1. In this pape r , w e present dynamic algorithms in R 2 for main taining the half-space depth of a data point in O (log n ) time per upda te, the rank-based con- tours in O ( n log n ) time per up date, and the c over-based co ntours in O ( n log 2 n ) time p er update. This researc h was partiall y supp orted by NSF grant s #CCF- 0431027 and #CCF- 0830734. 1 2 MICHAEL A. BURR, EYNA T RAF ALIN, AND DIANE L. SOUV AINE The half-space depth (sometimes called the lo cation depth or the T ukey depth) of x ∈ R d relative to a data se t F n = { X 1 , · · · , X n } is the minimum fr action of po int s of F n lying in any closed half-space co ntaining x . In R 2 , the half-space depth of a single p oint can b e co mputed in optimal O ( n log n ) time [Aloupis et al., 2002; Ruts and Rousseeuw , 1996b; Bremner et al., 2008] a nd the half-space depth of all p o ints can b e computed in O ( n 2 ) time [Miller et al., 200 3]. In higher dimen- sions, [F ukuda and Ro sta, 2003; Bremner et al., 2008; Rousseeuw a nd Str uyf, 1 998; Struyf and Ro usseeuw , 2000] prese nt a lg orithms to compute the half-spa ce depth of a s ingle p oint. The half-sp ac e me dian is a p oint of maximal half-s pace depth (if more than one p oint has maxima l depth, then the c e n ter of mass of all s uch p oints is commonly used); in R d , the ha lf-space depth o f the median is at least j n d +1 k /n by Helly’s theo rem [Eckhoff, 1 993] and at most ⌈ n/ 2 ⌉ /n (for data sets without dou- ble p oints). In R 2 , a p oint with maximal depth can b e computed in O ( n log 3 n ) time [Langerman and St eiger, 2003], and [Chan, 2 004] presen ts a ra ndo mized al- gorithm to compute the median in O ( n log n ) expected time. Chan’s a lgorithm extends to higher dimensions wit h an exp ected time of O ( n d − 1 ). F or other results, see [Ruts and Rousseeu w, 1996a, 1 998; Mato u ˇ sek, 1 991; Langerman and Steiger, 2000]. A c enter p oint is a p oint with depth at lea st j n d +1 k /n . In the plane, [Jadhav a nd Mukhopa dhya y, 19 9 4] pr esent an O ( n ) algor ithm for computing a cen- ter p oint. F or other results, se e [Cole et al., 198 7; Matou ˇ sek , 1991; Co le, 19 87; Agarwal et al., 2 008] The sample c over c ontour of depth d/n [T ukey, 19 75] is the b oundar y of a ll p oints (not necessa rily from the da ta set) with depth at leas t d/n . The idea b ehind the cov er-based co ntours is based o n the assumption that the data set is generated from an underlying distribution and that the contours s ho uld repr esent the b e havior o f the underlying distribution. T he sample r ank c ontour of the α th c entr al r e gion is the con vex h ull containing the α most cen tral fraction of data points [Liu et al., 1999]. The rank-ba sed contours fo cus mor e on the data p oints themselves be c ause data p oints may repres ent actual o bserv ations, see Figure 1 . Therefore, only data po int s can b e vertices of rank-based co nt ours , and they may app ear on multiple contours. On the other hand, non-data p oints fro m R d can b e v ertices of cov er- based contours a nd each data p o int will o ccur on a single contour (for data sets in general p os ition). F or sufficiently nice underlying dis tr ibutions, b oth types o f con- tours will, a lmost surely , appro a ch the ha lf space depth co nt ours for the underlying distribution [Zuo and Serfling, 200 0]. Although the rank-bas ed co n tours lack some of the str ucture of the cov er-bas ed contours, they often provide a rea sonable and less computationally expensive contour. In R 2 , an y half-space depth cov er-based contour edge lies on a seg men t b etw een tw o data p oints. At most  n 2  such segments exist, thus the complexit y of the co llection of half-space cover contours is O ( n 2 ). This b ound is tight, a nd it is achiev ed, for example, when all p oints o f the data set lie o n the conv ex hull of the data set. Rank-based depth contours, by definition, enclose the 1 st, n − 1 n th, . . . , 1 n th s a mple r egions, hav e a total complexity of O ( n 2 ) (once data p oints of the same depth have b een arbitr arily ordered), but only in- volv e Θ( n ) distinct edges since man y cont ours shar e edges. (The bo und on the nu mber of edg es ca n be prov ed by a mortizing the complexity over the data p oints since the difference b etw een succes s ive co nt ours is induced by removing a p o int and its tw o incident edges .) In R 2 , [Miller et a l., 200 3] prese nt an optimal algo rithm DYNAMIC MAINTENANCE OF HALF-SP ACE DEPTH F OR POINTS AND CONTOURS 3 that c omputes all o f the cover-based contours in O ( n 2 ) time; at the same time, it computes the depth o f every data p oint, and, therefore, ca n also b e us e d to com- pute rank- based contours. Several implementations ex is t fo r computing cov er-based contours: isodepth [Ruts and Rousseeuw, 1996 b] can c o mpute the k th contour in O ( n 2 log n ) time. fdc [Johnson et al., 1998] computes the outermost k co ntours and outp erfor ms isod epth for small k . Using hardware assisted computatio n, [Krishnan et a l., 200 2] compute the ha lf-space depth cov er-ba sed contours for dis - play . [Chan, 20 04] presents a n algo rithm to co mpute the c ov er-based depth co nt our of depth k in O ( n log 2 n ) exp ected time. In higher dimensio ns , [F ukuda and Rosta, 2003] prese nt an alg orithm for the computation of these contours. (a) (b) Figure 1. Half-s pace depth: (a) All c over-b ase d contours for 5 0 po int s fr om a biv ariate normal distribution with mean (0 , 0) and cov ariance matr ix 4 I ; (b) The 10 % , 20% . . . 1 00% ra nk-b ase d con- tours for the same data set. Both sets o f contours have similar shap es, but are comp osed o f distinct p olygons : for exa mple, the cov er-based contours do not shar e vertices while the r ank-base d contours do share vertices. F ew dy namic alg orithms (allowing the inser tion or deletio n o f da ta po int s) for data depth computations exist, despite the in terest of the statistical comm unit y [Liu, 200 3]. Recently , [Abbott et al., 2009] presented a dynamic alg orithm which can be used to main tain a point of ha lf-space depth at lea st 1 / 4 and also a dy- namic algor ithm whic h deals with the case whe r e the conv ex h ull p eeling depth [Barnett, 1976; Eddy, 1982] o f a data set is bo unded. Another result, presented in [Agarwal and Mato u ˇ sek, 19 9 5], dynamically maintains a data structure for half- space queries; this s olves a differen t, but related, problem than to maintain the half-space depth of a p oint. F or cov er c o ntours, our alg orithm is essentially main- taining the k -b elts of a n arrang ement , a s int ro duced in [E delsbrunner and W elzl, 1986]. In [Edelsbrunner and W elzl, 19 86], the a uthors cons truct the levels of a n ar- rangement using a sweepline and claim, in passing, that the a lgorithm can b e made dynamic. While their algo rithm is related to o urs since we are solving the same problems and use similar techn iques a nd tricks, it is difficult to co mpare the alg o- rithms: the author s neither provide an explicit version of their dyna mic algor ithm nor any claims as to its complexity . 4 MICHAEL A. BURR, EYNA T RAF ALIN, AND DIANE L. SOUV AINE This pap er presents the first dynamic algo rithm fo r computing the half-space depth contours in R 2 of a da ta set o f n points in general p osition. In Sec tion 2, we review some pro per ties of half-space depth and half-space depth con tours. In Section 3, we pr esent an alg orithm for maintaining the half-space depth of a single po int in O (log n ) time p er op era tio n (insertion or deletio n) and linear ov erall spa ce. The data structure that w e use w as o riginally presented in [v an Kreveld et a l., 1999], but we augment it to enable dynamic up dates. In Section 4 , we expa nd the algorithm and augment the data structure in Section 3 not only to maintain the depth of a point, but a lso to maintain the cov er-based contours nea r p oints that do not lie o n deg enerate contours, i.e., contours co nsisting o f either a sing le p oint or tw o p oints and the seg ment b etw een them. Through this ana lysis, we present a theorem of indep endent int erest that shows that the cov er-ba s ed contours ca nnot change to o muc h after a n inser tion or deletion. In Section 5 , we use the algo rithm from Section 3 (or from Section 4, since that algorithm is an augmented version of the algorithm from Section 3) to develop an algo r ithm to ma in tain the ra nk- based ha lf-space depth contours in O ( n log n ) time pe r upda te and ov erall q uadratic space. In Section 6 , we present an algo r ithm and data structure to maintain the cov er-based half-space depth contours in O ( n log 2 n ) time p er o per ation a nd overall quadratic space. Both of these algor ithms repr esent improv ements ov er the static running time o f O ( n 2 ). Finally , we co nclude in Section 7. 2. H alf-Sp ace Da t a Depth and Contours In this section, we review the basic definitions and prop erties of half-space depth and its contours. In this direction, we provide alterna te co m binator ia l descriptions of these definitions which will b e useful througho ut this pap er. F or exa mple, the global description of the co ntours will be used in Section 6, and the discussion of the des cription o f the loca l half-spa ce depth contours near a data p oint will be completed in Section 4. All of the half-spa ces consider e d in this pap er are closed. Definition 2.1 ([T uk ey, 1 975]) . The half-spac e depth of a p o int p with re sp ect to a data set F n = { X 1 , · · · , X n } is the s mallest fractio n of data po int s co nt ained in a half-space co ntaining p , i.e., min { (# H ∩ F n ) /n | p ∈ H a half-spa ce } . It is s ufficient to consider o nly half-space s that include p in their b oundar y , i.e., min { (# H ∩ F n ) /n | p ∈ ∂ H, H a half-spa ce } . There is so me tension b etw een how half-spa ce depth is co mputed in the statistics and probability communit y and in the computational geometry co mm unity . The statistics and pr o bability viewp oint defines half-space depth in terms of probabilities ov er half-s paces [Liu et al., 1999]. The co mputational geometry viewp oint prefers to count the num b er of data p oints in a half-spa ce. In our definition, we choose to represent the half-space depth as the fra ction, instead o f the num ber, o f p oints o f F n in the ha lf-s pace H bec a use this definition more accurately refle c ts the relations hip betw een the finite sa mple ca se and the contin uous cas e , i.e., the definition for distributions [Liu et a l., 1999]. Ev en thoug h we use this definition in our theoretical pro ofs, in our alg orithms, the standard computational geo metry definition beco mes more desira ble to maintain our time complex ities . Half-space depth ha s many nice pro p er ties. The half-space median is robus t in the presenc e of outlier s b ecause Helly’s theorem implies that at least j n d +1 k of the data po int s in F n m ust b e outliers to alter the p osition o f the median sig nificantly . DYNAMIC MAINTENANCE OF HALF-SP ACE DEPTH F OR POINTS AND CONTOURS 5 Half-space depth has all of the desirable prop erties for a data depth function: affine inv ariance, maximalit y at the center, monoto nicity relative to the deepest po int , v anishing at infinity , and in v ar iance under dimensions change [Zuo a nd Serfling, 2000; Burr et al., 200 6]. 2.1. Half-Space Depth Contours. There a re tw o main de finitio ns for da ta depth contours called the cov er-ba sed co ntours a nd the ra nk -based contours [Rafalin a nd Souv a ine, 2004], and, for most data sets, they provide distinct contours. Definition 2.2 (Cover-based contours [T ukey, 1975]) . The c over-b ase d c ontour of depth t is the boundar y of { x ∈ R d | Half-spa c e depth of x is at least t } . This approach constructs a cont our around a ll points of R d (not necessarily fr o m the data s e t) with half-s pace depth a t least t . A simple, alb eit inefficient, w ay to compute the cov er-based contour o f depth t in R d (whic h w ill be justified below) is a s follows: first, divide the plane in to cells determined by h yp er-pla nes through d data p oints. The ha lf-s pace depth is constant in e a ch of these ce lls. Seco nd, pick a po int in each cell (which ca nnot b e a data p oint), and co mpute its half-spa ce depth. Finally , tak e the clos ur e of the union o f all c ells with ha lf-space depth at least t ; the bo undary o f this region is the cov er-based contour of depth t . Definition 2.3 (Rank-based contours [Liu et a l., 199 9]) . The r ank-b ase d c ontour of the α th c entr al r e gion is the conv ex hull of the α most central fra ction of data po int s where ties are broken arbitrar ily . This appro ach c onstructs a contour ar ound the dee pes t da ta p oints. A simple way to compute the ra nk-based contour of the α th central reg ion is to first co mpute the depth of every data p oint and sort the data p oints by depth (in this s orted list, ties are bro ken arbitrar ily). Then, take the n · α data p oints with largest half-space depth (with res pec t to the a r bitrary or dering) and compute the co nv ex hull of this s et. This conv ex h ull is the r ank-based contour of the α th central re g ion. Both co ntour definitions can b e adapted to any data depth function by the appropria te change in the definition. In this g enerality , both contour de finitio ns hav e their mer its, for example, the ra nk -based con tours are alwa ys con vex and nested while the cov er-base d contours have more structure, s ee [Burr et al., 20 06]. F or ha lf-space depth, in pa rticular, the cover-based co ntours can be described in terms of a ce rtain finite collection of half-spaces deter mined by the da ta p o ints. On the other hand, the ra nk-based contours hav e no such descr iption. In the remainder of this section, we reca ll this desc ription. W e b egin with the following a s sumption: for the remainder of the pap er , we assume that al l data sets ar e in gener al p osition . The definition o f half-spa ce depth is a minimization problem ov er all half-spaces that contain a given p oint p . As is usual in this setup, there is a dual problem that describ es all p oints of a given half-spa c e depth, as in the following prop osition: Prop ositi o n 2.1. The c over-b ase d c ontour of depth k /n in R d is the b oundary of the int erse ct ion of al l close d half-sp ac es c ontaining exactly n − k + 1 data p oints. This r esult can, in fact, b e impr oved to only consider a finite num ber of half- spaces. 6 MICHAEL A. BURR, EYNA T RAF ALIN, AND DIANE L. SOUV AINE Corollary 2. 1. The c over-b ase d c ontour of depth k /n in R d is the b oundary of the interse ction of al l close d hal f-sp ac es c ontaining exactly n − k + 1 data p oints and whose b oundary c ontains exactly d data p oints. These res ults are not difficult, but they b oth r equire some technical, linear algebra- type lemmas. F or exa mple, one wa y of pro ving these equiv alences is to use translations and rotatio ns, s ee [Cole et a l., 1 987] for a sk etch. T o translate a given ha lf-space mea ns to find a second half-space whose bo unding h yp erplane is parallel to the b ounding hyper plane of the or iginal half-space and b oth half-spaces op en in the same direction. T o rotate a giv en half-space around a subflat of the bo unding hyperplane means to find a se c ond half-space wher e the b o unding hyper - plane includes the given subflat (alternately , this r o tation ca n be interpreted a s a po int in the appropria te Gr a ssmannian). Note that Cor ollary 2.1 do es no t say that the d da ta p o in ts lie on the contour of depth k / n , o nly tha t the faces of the contour of depth k /n lie in hyper-pla nes that each contain d p o ints, but these p oints may be far fro m the contour itself, e.g., see Figures 1(a) and 2(a). In addition, Corollary 2.1 provides an explicit wa y to c o mpute the half-space depth of a data po int by inv estigating a finite num ber of ha lf-spaces. In pa rticular, we will use the following cor o llary (in 2-dimensions) to motiv ate our da ta structures: Corollary 2.2. If p is a data p oint of F n in R d , then to c ompute the half -sp ac e depth of p it is sufficient to c onsider half -planes whose b oundaries include b oth p and d − 1 other data p oints of F n , i.e., min { (# H ∩ F n − ( d − 1 )) /n | # F n ∩ ∂ H = d and H a half-sp ac e } . Note that the − ( d − 1 ) /n app ears in the formula b e c ause a small rotation ca n remov e the ( d − 1) data p oints, other than p , from ∂ H . Since every da ta p o int app ears o n s ome co nt our, Cor o llary 2.2 implies the fo llowing corolla ry which is an initial descr iption for the lo cal cover-based contours near a data p o int: Corollary 2.3. If p is a data p oint of half-sp ac e dep th k /n in R d , then the e dges of the c over-b ase d c ontour of depth k / n that ar e incident to p ar e define d by planes thr ough p and d − 1 other data p oints. 2.2. T erminology. Our discuss ion ab ov e has highlighted the data which we need in order to maintain the rank-based or co ver-based contours. In this section, we define the terminolog y for the half-spaces and their asso ciated geo metric ob jects which will be used through the remainder of this pap er. W e beg in with the following assumption: for the remainder of this pap er, we r est rict ou r att ention to R 2 . F or most cover-based co ntours, the contour bo unds a reg io n, but, for the deep est contour, it is p ossible that the contour do es not b ound a reg ion, but co nsists of either a sing le p oint o r a segment. Our algorithm must trea t these degenera te co ntours as a sp ecia l cas e . Definition 2.4. A cov er-ba sed contour is de gener ate if it consists of either a single po int or of tw o p oints co nnected by a segment, see Figure 2(a). It is easy to show using Corollar y 2 .1 that the o nly time that a deg enerate cover- based co nt our co ns ists of a segment is when the data s et ha s exactly tw o p oints. In non- de g enerate ca ses, the half-s pace depth c o ntours b o und a r e gion and we now define the features of these r egions lo ca lly nea r a data p oint: DYNAMIC MAINTENANCE OF HALF-SP ACE DEPTH F OR POINTS AND CONTOURS 7 to q q away p q (a) (b) Figure 2. (a) Degenerate ha lf-space depth contours: A set of 6 p oints. The outermost contour is the conv ex h ull of the data set; the next contour co ntains 5 vertices, no ne a p oint of the data set. The inner- mo st con tour con tains one da ta point. (b) The transformatio n of the half-planes determined by q and p . The b old semicircle r epresents all half-pla nes whose num b er of p oints will b e incremented (decremented) b y o ne when q is inserted into (deleted from) the data s et beca use q is to the right of the ass o ciated vector. Definition 2.5. The defining e dges (lines) o f data p o in t p of half-spac e depth k /n with resp ect to the data set F n , whose cover-based contour of depth k /n is non-degenera te, are the t wo edges (lines defined b y the edges) inciden t to p on the cover-based co ntour of depth k /n . W e will use the notation l 1 and l 2 for the defining lines. Each of the defining lines for a po int p deter mines tw o half-planes, one of which contains n − k + 1 data p oints while the o ther contains k + 1 data p o ints. The ha lf- plane containing k + 1 da ta p oints is imp or ta nt b ecaus e it descr ibes the contour of depth k /n lo cally a nd provides a witness for the depth of p , see Fig ure 4 . Definition 2.6. The defining half-pla nes H l 1 , H l 2 for data point p o f depth k /n with resp ect to F n , whose cov er-base d of depth k /n c ontour is non-deg enerate, a re the closed half-planes bo unded by the defining lines of p oint p with resp ect to F n and which co nt ain k + 1 data p oints. Corollar y 2.1 implies that the defining lines for a data p oint p must pas s through an additional data p oint. F o r our dyna mic algor ithms, it makes sense to keep track of a ll p os sible half-planes which could b e new defining half-planes after an insertion or deletion, i.e., all ha lf-planes whose b oundary includes p and a n additional data po int . Definition 2.7. T he me aningful half-planes are the ha lf-planes whose b ounding line pa sses through tw o da ta po int s. Let p b e a data p oint, then the meaningful half-planes with resp ect to p ar e all of the meaningful half-planes whose bo undary includes p . Note that there a re 2( n − 1) meaningful half- pla nes with res p ect to p since every line determines tw o ha lf-pla nes. Since is is not enough to use line s to keep track o f meaningful half-pla nes, we choose to repr e s ent half-planes as (unit) vectors or, eq uiv alently , the p o ints on the 8 MICHAEL A. BURR, EYNA T RAF ALIN, AND DIANE L. SOUV AINE unit circle centered at p wher e the unit vectors ter mina te. The half-plane asso ciate d with a ve ctor v cen tered at p is the half-plane consisting of all data p o int s to the right of the ve ctor , i.e., all p oints q such that the clo ckwise angle b etw een v and the vector v q , the vector from p to q , is less than or equal to π , se e Figure s 2(b) and 3 4 3 2 r q p r r r r 1 5 r 1to r r r r r r r 2to r 5to 4to 3to 3away 2away 1away 5away r 4away q r r r r 1 p r 2 3 4 5 (a) (b) Figure 3. The transfo rmation of the meaningful half-planes with resp ect to p : (a) P oint q is b eing inserted into (or deleted from) the data set. (b) The vectors r epresent the tw o half-planes defined by ea ch da ta p oint a nd p . The half- pla ne as so ciated with a vector consists of all p o ints to its right so that the shaded reg io n repres e n ts the set of half-planes whic h co nt ain q . In par ticular, the shaded region represe n ts the set of half-planes whose num ber of included po int s incre a ses (decrea ses) when q is inserted into (deleted from) the data set. O n the other hand, q , r 1 , and r 5 are in the half-pla ne asso ciated with the vector po inting tow ards q . 3. Dynamic Maintenance the Depth of Da t a P oints In this section, we present an algo r ithm to maintain dynamically the half-space depth of a da ta po int in O (log n ) time per insertion or deletion and linear spa c e ov erall. This is an imp ortant step in the maintenance o f the ra nk-based contours bec ause these contours are based o n the depths of the data p oints. One o f the simplest O ( n log n ) algor ithms for co mputing the half-space depth of a p oint p , not necessarily a da ta p oint, is the following alg o rithm [Aloupis et al., 2002]: First, sort all of the data p oints r adially around p . Next, use tw o pointers to step through this list. The tw o p o in ters are separa ted by an angle of π to represent a half- pla ne passing through p . Finally , keep track of the smalle st fractio n of data po int s b etw een the tw o p ointers; this v alue, minus 1 /n , is the half-s pace depth of p (the − 1 / n app ears as in Cor o llary 2.2). In this section, we turn this static algo rithm into a dynamic a lgorithm. T he static version of the data structure that we us e was orig inally presented by [v a n Kreveld et a l., 1999] for a different problem. 3.1. The Angular T ransformation. The first step in the static algo rithm ab ov e is to sort the da ta p oints r adially around data p oint p . In the dynamic algo r ithm, we instead need to maintain the s orted list of data p oints. In the a lgorithm ab ov e, DYNAMIC MAINTENANCE OF HALF-SP ACE DEPTH F OR POINTS AND CONTOURS 9 we needed tw o p o in ters to find the depth of p ; therefore, o ur data structure will maintain all of the meaningful half-pla nes with resp ect to p . W e repres e n t the half- planes as unit vectors or iginating a t p , as descr ib ed in Section 2.2. Since every data po int , other than p , defines tw o mea ningful half-planes, we lab el the vector p ointing tow ards the point “to” and the vector p ointing aw ay fro m the p o int “awa y ,” se e Figures 2(b) and 3. The adv antage of this r e presentation is that the up dates to the co unt of po ints in meaning ful half-planes after an insertion o r deletion are rela tively simple to describ e. In fact, when a p oint q is inserted into (deleted fro m) the data s e t, the only half-planes that need to b e adjusted a re those in the semicir cle counter- clo ckwise from q to to q aw ay , see Figur e 2(b). In the case o f a cir c le, this semicir cle is an arc and ca n b e used to upda te the num ber of points in the ha lf-planes in sub-linear time. 3.2. Data Structure for Up dating the Half-Space Depth of a Data Poin t. In orde r to re c ompute the depth of po int p after an ins ertion o r deletion, first, the num ber of data po ints in every meaningful half-plane with resp ect to p has to be reco mputed. Then, the minim um n umber of da ta p oints in these meaningful half-planes must b e computed. If this num b er is k + 1, then the depth of p will be k / ( n ± 1) wher e the ± cor r esp onds to the insertion or dele tio n of a data p o int. T o recompute the depth of p efficiently , all meaningful ha lf-planes with resp ect to p are upda ted s im ultaneously by increa sing o r dec r easing the num ber o f po ints asso ciated with a ll affected half-pla nes by one. W e requir e a data structure that maintains all o f the mea ningful half-planes for a given p oint p and which allows insertio ns and deletions in O (log n ) time. The static version o f this data s tr ucture was o riginally presented in [v a n K reveld et a l., 1999] for a different problem. W e beg in by de s cribing the op era tions which ar e necessary for a data structure to solve this problem and then dis cuss o ur par ticu- lar implementation (in Sectio n 4, we will augment this data s tr ucture in order to maintain mo re o f the lo cal structure of the depth contours). Let T b e the da ta str uctur e repr esenting the s e t of meaningful half-plane s with resp ect to p . Eac h mea ningful half-plane is lab eled by a non-neg ative integer De pth , which is the num b er of data po int s in the half-plane. • I ncrem ent(T , left, right), Decreme nt(T, l eft, right) - Given a counter- clo ckwise cir cle segment defined by its tw o end-dir e ctions ( left and right ), increment or decr ement the De pth of all vectors within the cir cle se g ment. • I nsert (T, q ′ , k ′ , to) - Given a new vector q ′ , the num ber of data p oints k ′ in the ha lf-plane co r resp onding to q ′ , a nd a b o olean v a lue to reco rding if q ′ po int s tow ards a da ta p oint, up date the data structur e to include q ′ . • R emove (T, q ′ ) - Given a p ointer to an exis ting vector q ′ , delete q ′ from the data s tr ucture. • M inDep th(T) - Return the minim um num b er of p oints in a meaning ful half-plane a sso ciated with p . 3.2.1. D etaile d O p er ations. In our implement ation, the data structure is an aug- men ted dynamic ba lanced binary search tree re presenting the meaningful half- planes asso ciated with p . The leav es of this tree corresp ond to the meaningful half-planes and therefo re the height o f the tre e will b e O (log n ). Ea ch meaningful half-plane will b e r e presented in a leaf by its co rresp onding p oint on the unit circle 10 MICHAEL A. BURR, EYNA T RAF ALIN, AND DIANE L. SOUV AINE in the rang e [0 , 2 π ), i.e., the counter-clo ckwise angle from the positive horizontal vector to the vector asso ciated with the half-plane. The leaves of the tree a re sorted by their directio n in the interv al [0 , 2 π ). The leav es of the tree ar e augmented with thre e fields: the direc tion , D epth , and to fields. T he directio n is the v alue in [0 , 2 π ) corr esp onding to the v ector asso ciated with the meaning ful half-plane. The Dept h is the num b er of data p oints in the repre s ented meaningful half-plane. The to is a b o o lean v a lue that is true if the vector co r resp onding to the meaningful half- pla ne p oints tow ards a data p oint and fa lse if it po int s awa y . The internal no des of the tree ar e a ugmented with three fields: the minDe pth , m axDep th , and subt ree-a dditio n fields. The minDep th and maxDep th fields o f a no de contain the minimum and maximum Dept h v alues of all leav es in its subtree. The subtr ee-ad dition v alue is a num be r by which all o f the leav es of the no de s hould b e incre mented o r decr emented. The ac tua l upda tes are deferred unt il a trav ersa l of this tree is necessar y . T o p e rform a n Incremen t(T, le ft, right) o r De cremen t(T, left , right) the Depth v alues for leaves or the subtree -addit ion v alues for internal nodes are incremented or decremented to represent the change in all leaves in a counter- clo ckwise direction from left to righ t . This can b e p erformed by traversing the paths from the leftmost leaf to the righ tmost leaf of the interv al from left to right . While trav ersing these paths, the appropria te Dept h or sub tree- additi on v alues of the c hildren o f this path b etw een lef t and r ight a re incremented or decremented. In addition, the minDe pth a nd maxD epth fie lds of all a ncestors of q ′ may b e adjusted as well, if necessa ry . An Inser t(T, q ′ , k ′ , to) or R emove (T, q ′ ) can b e per formed with a s ta ndard dynamic binary tree insert or delete along with a n a djustmen t of the min Depth a nd maxDep th fields o f the ancestors of q ′ , if necessar y . This adjustment can b e per - formed by trav ersing a path from the ro ot of the tree to q ′ . The MinDe pth(T ) can be per formed by examining the r o ot of the tree: the min Depth v a lue o f the ro ot main- tains the half- s pace depth o f p , i.e., the half-space depth of p is ( mi nDept h (ro ot) − 1) /n . Using these o pe rations, an insertion or deletion of a data point q is straight- forward. Let T b e the tree and q to be the vector fr o m p pointing tow ards q and assume that the ang le it makes co un ter-clo ckwise from the p o sitive horizo ntal vec- tor is γ . In additio n, let q away be the vector from p pointing aw ay from q . The half-planes that contain q are those with dire ction in the in terv a l [ γ , γ + π ] (or [ γ , 2 π ) ∪ [0 , γ − π ] if γ ≥ π ). T o insert q , first p erfor m I ncrem ent(T , γ , γ + π ) (o r the t wo incr ements on the interv als describ ed a b ove) and then p erform In sert( T, q to , k , true) and I nsert (T, q away , n − k + 2 , false) , where k is the num b er of p oints in the half-plane corres p o nding to q to and can b e computed eas ily by con- sidering the Dep th and to fields of a neig hbor of q to in the tre e. T o delete q , first per form Dec remen t(T, γ , γ + π ) (or the tw o decr ements on the interv als describ ed ab ov e) and then p erform Remov e(T, q to ) and Rem ove(T, q away ) . The tree, whic h stores the 2( n − 1) vectors corres p o nding to mea ningful half- planes with re s pe ct to p , has linea r structure and all op era tions require lo garithmic time. Since only a s ingle regio n is incremented or decr ement ed, the dynamic tr ee on the set o f vectors allows asso cia ted v alues to b e up dated in logar ithmic time. DYNAMIC MAINTENANCE OF HALF-SP ACE DEPTH F OR POINTS AND CONTOURS 11 Theorem 3.1. An algorithm exists that c an dynamic al ly maintain the half-sp ac e depth of a data p oint r elative t o a dynami c set of n p oints in O (log n ) t ime p er op er ation and line ar sp ac e. Pr o of. T o maintain the half-space depth of a sing le p oint p the min Depth field of the ro ot needs to b e co nsidered after every up date. The depth of p is ( minDep th ( r oot ) − 1) /n .  4. Dynamicall y Upda ting Local Cover Contours In this sectio n, we augment the data str ucture fro m Section 3 to ma in tain the defining half-pla nes for the p oint p . These half-planes provide a witness to the depth o f p . In addition, knowing the defining half-planes for p provides a co nstant time answer for the depth c hange query: if q is inserted into or removed from the data set, will the half-space depth of p c hange? W e beg in b y discussing six prop erties of the half-space depth cov er contours and meaningful half-planes with resp ect to the data point p . After this, we ana lyze v ario us c a ses of insertion o r deletion with res pe ct to the p oint p . Thes e cases prove Theor em 4.1, a theorem of independent in terest, that s hows that defining half-planes cannot change to o muc h after an ins ertion or deletio n. Since this section dea ls with the defining half-planes, which are not defined for dege nerate contours, all of our data p o ints must lie o n a non-degenera te contour bo th b efor e a nd after an up date. At the end o f this sec tion, we descr ib e a test which can determine if a p oint is on a degenerate co n tour: it amounts to failing the counting prop er t y , Pr op erty 3, b elow. 4.1. Prop e rties of the Dynamic Con tours. The transformation in Section 3 allows us to present 6 imp ortant structura l prop erties for the mea ning ful half- planes. These prop erties ar e the k eys to our alg o rithm for updating the defining half-planes of individual points. Because these prop erties are technical, w e will fix some notation in this section. The angle of a ve ctor used to repr esent a half- plane is measured counterclo ckwise from the p ositive x -ax is. The no tation E l 1 will represent the c over-b ase d c ontour e dge that lies on the line l 1 . A ha lf-plane will b e written H l where l is the b oundary line of this half-plane ; although this nota tio n is not unique, the half-plane chosen will be clear from con text. A vector will b e written as v H l , where H l is the half-pla ne represented by the vector, or as q to and q away when the ve ct ors ar e asso ciate d with the data p oint q , see Figures 4(a) a nd 3. F or these pr op erties, w.l.o.g ., as sume that p is the orig in. Prop ert y 1. Conv exity prop erty : This prop erty simplifies the following ar- guments and no tation by fixing a sta nda rd o rientation for a data p oint a nd its asso ciated contour: Every ha lf-space depth c o ntour is conv ex, constraining the an- gle b etw een the tw o vectors a sso ciated with the defining ha lf-pla nes, H l 1 and H l 2 . If edg e E l 2 is adjacent to E l 1 clo ckwise along the contour of depth k / n with v H l 1 po int ing tow ards the p o sitive x -axis and if the interior o f the contour lies immedi- ately a bove the p ositive x -axis, then v H l 2 po int s into the low er semicircle and the angle of v H l 2 is φ ∈ ( π , 2 π ), see Fig ur e 4(a). Prop ert y 2. Insertion Prop erty : This pro p er ty describ es the updates needed as p oints are a dded to or deleted from the data set: When a da ta p oint q is a dded to (deleted from) the data set, the n umber of data p oints increas e (decreas e) by one in all half-pla nes that contain q : those whose vectors lie in c ounter-clockwise 12 MICHAEL A. BURR, EYNA T RAF ALIN, AND DIANE L. SOUV AINE int erv al from q to to q away . If q to has angle γ then the affected half-planes hav e angles [ γ , γ + π ], see Figure 2(b). (If γ ≥ π , then, for the c o mputations b elow, it is easier to write this interv al as [ γ , π ) ∪ [0 , γ − π ].) 00000000000000000000000 00000000000000000000000 00000000000000000000000 11111111111111111111111 11111111111111111111111 11111111111111111111111 φ p 1 l l 1 v 2 v 2 γ q Region 3 Region 2 Region 4 The contour of depth k/n Region 1 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 000000000000000000000000 000000000000000000000000 000000000000000000000000 111111111111111111111111 111111111111111111111111 111111111111111111111111 p 2 1 l l 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 >=k+1 >=k+2 through data points depth k 2 data points φ >=k+1 through 2 p >=k (a) (b) Figure 4. (a) The conv exity pr op erty: The four regions defined by the defining lines for p , and the angle to q . The vectors v 1 and v 2 are the vectors a sso ciated with the defining half-planes, and l 1 and l 2 are the defining lines. In addition, this con tour is in the standar d p ositio n by the conv exity prop erty since v 1 po int s along the p ositive x -axis and v 2 po int s b elow the x -axis. (b) The counting prop erty: The num be r of p oints in re g ions des crib ed in the counting and converse co un ting prop er ties. F or example: If the vector as so ciated w ith a half-plane p oints into the interv al (0 , φ ), then the ha lf-plane contains at least k + 1 da ta p oints. If the vector asso ciated with a half-plane po int s into the interv al ( φ, 2 π ) and its bo unding line pas ses throug h t wo da ta p oints, then the ha lf-plane also contains at le a st k + 1 data p oints. Prop ert y 3. Coun ting Prop ert y: This prop erty descr ibes the minimal num ber of data p oints in a ny half-pla ne with resp ect to the lo ca l depth contour at a data po int : Let H m be a half-pla ne wher e m passes through data p oint p with half-space depth k /n . Then, if H m int ersec ts the interior o f the cov er-based contour of depth k /n , then it must co ntain > k p oints and if it do es not intersect the interior of the cov er-based contour, then it must contain ≥ k p oints, s e e Figure 4(b). In pa rticular, assume that the defining half-planes for p ar e H l 1 and H l 2 and tha t they satisfy the orientation with a ngle φ as des crib ed in the con vexit y pr op erty , Prop erty 1 . F or any unit vector v H m with angle β , consider the num b er o f data points in its the asso ciated ha lf-plane. • If 0 < β < φ , then the half-plane H m int ersec ts the interior of the cov er- based co ntour of depth k /n a nd must contain > k data p o in ts; if m passes through p and a se c o nd data po int, then H m m ust co nt ain > k + 1 data po int s. Otherwise (for both cases) there w ould e xist a p o int (witnessed po ssibly via a r otation) in the interior o f the contour of depth k /n with depth less than k /n . DYNAMIC MAINTENANCE OF HALF-SP ACE DEPTH F OR POINTS AND CONTOURS 13 • If 0 = β o r φ = β then H m is a defining half-plane for p and con tains exactly k + 1 p oints. • If φ < β < 2 π , then H m contains ≥ k da ta p oints; if m passes through p and ano ther data p oint, then H m contains ≥ k + 1 data po ints (otherwise p would hav e depth < k /n ). Prop ert y 4. Con verse coun ting prop ert y: This prop erty shows that if the half- planes whose b ounding line pas ses through the da ta p oint p follow the conclusio ns of the co unt ing pro pe r ty , then the depth of p must b e k /n : Assume that there is a c o ntin uo us regio n on the unit circle, B , containing vectors who se asso ciated ha lf- planes hav e ≥ k + 1 da ta po int s; the half-planes defined by p and another da ta p o in t whose vectors ar e in B contain ≥ k + 2 p oints. The ha lf-planes whose a sso ciated vectors a re on the b oundar y of B must hav e 2 po int s on their b ounding line and their ha lf-planes contain exactly k + 1 p oints. The ha lf-planes whose vectors are in the complementary reg ion B C contain ≥ k p oints; the half-planes defined by p and another data p oint whose vectors a re in B C contain ≥ k + 1 p oints. Then p oint p m ust hav e depth k /n . Since every half-plane contains k p oints, the ha lf-space depth of p is a t lea st k / n . L e t H m be o ne of the half-planes forming the b oundar y of B and q the data p oint not equal to p on m . By a rota tion o f H m , a seco nd ha lf-plane can b e found which co nt ains all data p o int s except for q . This new half-plane will therefore co ntain p a nd k da ta p oints. Therefore, the depth of p is k / n , see Figure 4(b). Prop ert y 5. Lo cation prop erty: Giv en tw o candidate defining half-pla nes, i.e ., ones which contain the corr ect num b er of data p oints, this prop er ty describ es the po ssible p o s itions for the defining half-planes: Giv en tw o arbitrar y half-planes H m 1 , H m 2 whose bo unding lines each pass through po int p (of depth k /n ) and o ne o ther data p oint and which each co ntain k + 1 data po int s, then the vectors for the defining half-planes are restr ic ted to lie in t wo small interv als , see Figure 5 (a ). Assume v H m 1 po int s tow ards the p o sitive x -a xis and v H m 2 po int s in to the low er semicircle with angle β . By the conv erse co un ting prop er t y , Prop erty 4, the a ngles o f the asso cia ted vectors o f the defining half-planes must b e in the interv al [0 , β ]. Alternately , if an asso ciated vector fo r a defining ha lf-plane makes an angle in the interv al [ β − π , π ], then the union o f this half-plane, H m 1 , and H m 2 is the entire pla ne, contradicting the assumption that p is on a no n- trivial contour. Therefor e, the angles of the asso ciated vectors for the defining half-pla nes must come from [0 , β − π ) and ( π , β ], one vector from each interv al b eca us e, by the counting pro p er ty , Pro pe r ty 3 , H m 1 and H m 2 m ust lie in Region 2 from Figure 4(a). Prop ert y 6. Nestedness prope rty: This pro pe r ty shows that the con tour re- gions can only expand when a p o int is added to the data set: When a p oint q is added to the data se t, the half-spac e depth cover-based contour of depth k /n rela - tive to F n is nested in the half-spac e depth cover-based co nt our of depth k / ( n + 1 ) relative to F n ∪ { q } . When q is added, the depth of all ha lf-planes either increase s or remains the same. Thus, the depth of every po int either inc r eases or r emains the s ame. Assume p lies on a nontrivial co n tour with defining half-planes H l 1 and H l 2 and the depth of p remains unchanged when q is inser ted. In a ddition, assume that the defining half-pla nes for p satisfy the or ientation descr ib e d in the conv exity prop erty , Prop erty 1 . Then, the angles o f the asso ciated vectors for the defining half-planes after q is inserted must b e in the interv al { 0 } ∪ [ φ, 2 π ). 14 MICHAEL A. BURR, EYNA T RAF ALIN, AND DIANE L. SOUV AINE 0000000000000000000000 0000000000000000000000 0000000000000000000000 1111111111111111111111 1111111111111111111111 1111111111111111111111 p 2 m m 1 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 (π,β] β [0,β−π) 0000000000000000000000 0000000000000000000000 0000000000000000000000 1111111111111111111111 1111111111111111111111 1111111111111111111111 l 2 l 1 p 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 p φ−π >=k+2 through 2 data points depth k γ q >=k+1 through 2 data points φ >=k+1 >=k >=k+2 through 2 data points >=k+1 >=k+3 through 2 data points >=k+2 (a) (b) Figure 5. (a) The lo cation pr op erty: The tw o half-planes H m 1 and H m 2 are candidate defining half-plane s b ecause they include the correct n umber of data p oints. The a ctual defining half-planes m ust lie in the tw o smaller interv als [0 , β − π ) and ( π , β ] (one in each) to ensure that the c ounting prop erty , P rop erty 3, remains v alid. (b) Case 1: The counts of all half-planes whe n p oint q is inserted into region 1. The cont our shown is the old cont our of depth k /n . The depth of p and the defining half-planes for p remain unch ange d by the counting prop er ty , Pro p e r ty 3. 4.2. Possible Cases. C o nsider a data set F n befo re a nd after an up date step, where p oint q is either inserted in to o r deleted fr om the data set. Assume p oint p has depth k /n and lies on a nontrivial c o ntour b efore and after the up da te. In addition, a ssume that the defining half-planes for p with r esp ect to F n are H l 1 and H l 2 satisfying the or ient ation des crib ed in the conv exity prop erty , Prop erty 1. Le t the t wo defining half-planes for p after the up date (in F n ∪ { q } or F n \ { q } ) be H m 1 and H m 2 . In this case, lines l 1 and l 2 divide the plane into 4 regions, see Figure 4(a). Call regio n ( H l 1 ) C ∩ ( H l 2 ) C r e gion 1 . Call H l 1 ∩ ( H l 2 ) C r e gion 2 a nd ( H l 1 ) C ∩ H l 2 r e gion 3 . C a ll H l 1 ∩ H l 2 r e gion 4 . Let v = q to be the unit vector fro m p tow ards q and let γ b e v ’s angle. Consider the po ssible cas es crea ted by inse r ting q relativ e to the four r egions. Poin t q can b e inserted o nly int o the in terior of one of the four r egions (inserting int o the b oundary will violate general po sition) and deleted from the in terior of any of the four reg ions or a defining edge. W e first present a n analysis of the cas es created when a p oint q is inser ted into the set. Case 1. P o i n t q is inserted into region 1 (s ee Fi gure 5 (b)): q is ins erted into neither of the defining half-pla nes H l 1 , H l 2 , so 0 < γ < φ − π . Since the num ber of data p oints co nt ained in H l 1 and H l 2 do es not change, the depth of p re ma ins k / ( n + 1) by the conv erse co unt ing prop erty , Pr op erty 4. By the nes tednes s pro p erty , Prop erty 6, the new defining-ha lf planes must b e in the interv al { 0 } ∪ [ φ, 2 π ). By the lo cation pr op erty , Prop er ty 5, the defining half-planes must also b e in the int erv als [0 , φ − π ) and ( π , φ ]. The intersection of the tw o se ts is { 0 , φ } . Since a fter the up date p lie s o n a non trivial contour, then H m 1 and H m 2 are distinct so the defining half-pla nes for p r emain unchanged. DYNAMIC MAINTENANCE OF HALF-SP ACE DEPTH F OR POINTS AND CONTOURS 15 0000000000000000000000 0000000000000000000000 0000000000000000000000 1111111111111111111111 1111111111111111111111 1111111111111111111111 l p l 1 2 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 >=k+2 depth k φ p q γ φ−π >=k+1 >=k+2 through 2 data points >=k >=k+1 through 2 data points New defining half−plane >=k+1 >=k+2 through 2 data points >=k+3 through 2 data points Figure 6. Ca se 2: The counts of all half-planes when a p oint q is inser ted into reg ion 3 . The co nt our shown is the o ld contour o f depth k /n . The depth o f p remains unchanged, but the old defining half-plane with a ngle φ is no longer a de fining half-plane. It is the first ha lf-plane containing k + 1 p o ints and whose b oundary pa sses through t w o data points in the indicated r egion when tra versed clo ckwise from the γ + π a ngle. Case 2. P oin t q is inserted into region 2 or 3 (see Figure 6): q is ins erted int o exactly o ne defining half-plane. Assume q is inserted into r egion 3, thus H l 2 contains an extra p oint, H l 1 do es no t contain an e x tra p oint, and φ − π < γ < π . By the insertion prop erty , Pro pe rty 2, all half-planes with angles b etw een γ and γ + π include an a dditional p o int. H l l will not contain an additiona l p oint, so the depth of p will rema in k / ( n + 1), but H l 2 will include an extra p oint so it can no longer b e a defining ha lf-plane for p by the co un ting prop erty , Pro p e rty 3. By the nestedness pro pe r ty , Prop er ty 6, the angle of vector v H m 2 m ust b e in the int erv al U 1 = { 0 } ∪ [ φ, 2 π ). By the inser tion pro p e rty , P rop erty 2, every defining plane whos e vector ha s an ang le in the interv al U 2 = [ γ , γ + π ] includes an additional po int , therefore , by combining the c ounting prop er ty , Prop er ty 3, the a ng le for v H m 2 m ust b e in the interv al U 1 \ U 2 = [ γ + π , 2 π ]. By the counting prop erty , P rop erty 3, v H m 2 m ust b e the first vector encountered when trav ersing the vectors starting from v H l 2 counter-clockwise, whose b ounding line passes through tw o po int s a nd asso ciated ha lf-plane co nt ains k + 1 data p oints. Assume v H m 2 has a ngle β and consider the lo cation o f the se c ond defining half- plane H m 1 : By the lo ca tion pro p er ty , Pr op erty 5, the asso ciated vectors to the new defining half-planes must b e in the int erv als V 1 = [0 , β − π ) and V 2 = ( π , β ], s o v H m 1 m ust b e in the interv al [0 , β − π ) s ince v H m 2 ∈ ( π , β ]. How ever, by the nes tedness prop erty , Prop er ty 6, the angles of the asso ciated vectors for each of the defining half-plane must also b e in U 1 , but U 1 ∩ V 1 = { 0 } . Therefore , the ass o ciated vector for H m 1 m ust hav e angle 0, and H m 1 = H l 1 . Case 3 . P oin t q i s ins erted i n to region 4 (see Fi gure 7): q is inser ted int o bo th defining ha lf-planes, thus π < γ < φ . By the ins e rtion proper t y , Prop er t y 2, every half-plane whos e asso ciated v ector has angle in the in terv al [ γ , γ + π ] gains an additional point. Since γ > π , we safely r eplace this interv al with U = [ γ , 2 π ) ∪ [0 , γ − π ]. Combining these tw o ideas, we note that, in par ticular, every half-plane in the interv al { 0 } ∪ [ φ, 2 π ) ga ins an additional p oint. By the counting 16 MICHAEL A. BURR, EYNA T RAF ALIN, AND DIANE L. SOUV AINE 0000000000000000000000 0000000000000000000000 0000000000000000000000 1111111111111111111111 1111111111111111111111 1111111111111111111111 1 l p 2 l 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 >=k+1 φ p q γ φ−π >=k+2 >=k+3 through 2 data points >=k+2 depth k >=k+3 through 2 data points >=k+2 through 2 data points >=k+1 Possible new defining half−plane >=k+2 through 2 data points Figure 7 . Case 3: The count s all ha lf-planes when a p oint q is inserted into region 4. The cont our shown is the old cont our of depth k /n . The depth of p incr eases by 1 and at most one half-plane ca n mov e into the indicated region. The new defining half-plane will b e the firs t half-pla ne who se angle is either counter- clo ckwise from π or clo ckwise from φ − π whic h co n tains k + 1 po int s and whose b oundary passe s thro ug h tw o data p oints. prop erty , Pr op erty 3, ev ery half-plane whose vector has a ngle in the complement of U a lready co n tains at le a st k + 1 data p oints and every half-plane whose vector has angle in U , which prev io usly contained at least k da ta p oints, now contains at least k + 1. Therefore the depth of p increases to ( k + 1) / ( n + 1). The tw o defining half-planes of p re lative to F n , H l 1 and H l 2 contain k + 2 data po int s each. By the lo cation pr op erty , Prop erty 5, the angles of the asso ciated vectors v H m 1 , v H m 2 m ust be in the int erv als [0 , φ − π ) and ( π , φ ]. Assume that H l 2 is no longer a defining half-plane for p , then the angle of v H m 2 is in the interv al ( π , φ ). By the counting pr op erty , Pro pe rty 3, co mbin ed with the insertion pro pe rty , Prop erty 2, every half-plane whos e vector has angle in ( γ , φ ) co ntains at least k + 2 data p oints and whose b ounding line passes through t wo da ta p oints m ust c ontain k + 3 data p oints and cannot b e a defining half-plane for p . Thus, the a ngle for v H m 2 m ust b e in the interv al ( π , γ ]. Assume v H m 2 has angle β . By the co unting prop erty , Pro p e rty 3, v H m 2 m ust b e the first vector counter-clo ckwise fro m π to γ where m 2 passes through tw o data p oints and H m 2 contains k + 2 data p oints. Now, a ssume that H l 1 is als o no longer a defining ha lf-plane for p . Then by the lo cation prop erty , Pr op erty 5, the angle for v m 1 , must b e in the interv al (0 , β − π ). By constr uction, β ≤ γ , s o β − π ≤ γ − π . By the counting prop er ty , Prop erty 3, combined with the inser tion pr op erty , Prop er ty 2, every half-plane whose vector has angle in (0 , γ − π ) c o ntains at least k + 2 data points and whose bounding line passes through tw o data po ints must contain k + 3 da ta p oints and cannot be a defining half-plane for p . Ho wev er, since (0 , β − π ) ⊆ (0 , γ − π ) there is a contradiction since the angle for v m 1 m ust b e in that int erv al. Thus v m 1 = v l 1 and H m 1 = H l 1 . The case where H l 1 is no lo nger a defining half-pla ne is handled similar ly . T o desc rib e the c a ses dealing with the remov al of p o int q we w ill use the following theorem of indep e ndent interest that shows that the defining half-planes cannot change by muc h a fter an up date. DYNAMIC MAINTENANCE OF HALF-SP ACE DEPTH F OR POINTS AND CONTOURS 17 Theorem 4.1. L et p b e a data p oint which lies on a nontrivial half-sp ac e depth c ont our with r esp e ct to the data set F n and assume t hat after a p oint q is inserte d into (delete d fr om) F n , p onc e again lies on a nontrivial c ontour. Th en at le ast one of the two defining half-planes of p (with r esp e ct to F n ) r emains unchange d with r esp e ct to the new data set F n ∪ { q } ( F n \ { q } ). Pr o of. By ca s es 1-3, when q is inserted in to F n , one of the defining half-planes remains unchanged so the theore m is proved for the cases of insertions. The cla im is true whe n q is inserted, but assume, for contradiction, that it is false when q is deleted. Consider fir st deleting a nd then r einserting q . After these t wo up dates, the data set re tur ns to its orig inal state a nd the defining half-pla nes for p must b e unc hanged. Mo reov er, by a bove, the r e insertion of q ca n o nly change one of the defining half-planes for p with r e sp e ct to F n \ { q } . If the deletion o f q changed b oth defining half-planes, it is imp ossible for the r e insertion of q to return the defining half-pla nes to their orig ina l state. This is a contradiction a nd therefo re the theo rem is proved for the cases of deletions.  W e now a na lyze the ca ses where the p oint q is deleted. In particular, Theo rem 4.1 is no n- constructive for deletions, but the co nstructions themselves are necessa ry for the des cription of an a lgorithm. F or most o f these cas es, we determine the new defining half-planes by p erforming an insertion backw ards and co nsidering which t yp e of insertion could result in the desired situation. 0000000000000000000000 0000000000000000000000 1111111111111111111111 1111111111111111111111 l 2 l 1 p 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 p >=k >=k+2 through 2 data points depth k γ q >=k+1 through 2 data points φ >=k+1 >=k >=k+2 through 2 data points >=k+1 φ−π Possible new defining half−plane >=k+1 through 2 data points Figure 8. Case 4 : The counts o f all half-planes when p oint q is deleted from region 1. The con tour shown is the old co nt our of depth k/ n . The depth of p remains unchanged and at most o ne half-plane will mov e into the indicated region. The new defining half-plane will b e the first half-plane whose ang le is either clo ckwise from φ − π or counter-clo ckwise from π which co nt ains k + 1 po int s and whose b oundary passes through tw o data p oints. Case 4 . P oin t q i s del e ted from region 1 (see Figure 8): q is de le ted fro m neither of the defining half-planes , thus 0 < γ < φ − π . Consider the counting prop erty , P rop erty 3, combined with the insertion pro p erty , Pr op erty 2 , and con- sider a half-plane H l whose asso ciated vector v H l has angle β . If 0 < β < γ or γ + π < β < φ , then q do es not affect this half-pla ne and H l contains a t least k + 1 data p oints b oth b efore and after q w as removed and co n tains at lea st k + 2 data po int s if its bo unding line passes through t wo data po ints. If γ ≤ β ≤ γ + π , then q 18 MICHAEL A. BURR, EYNA T RAF ALIN, AND DIANE L. SOUV AINE is contained in H l and the num ber of data p oints in H l decreases by one. Befor e q was deleted H l contained a t least k + 1 data po int s a nd contained at leas t k + 2 data po int s if its bounding line passed thr ough t w o data po int s. After q was deleted, there are at leas t k p oints in H l and a t least k + 1 data p oints in a ha lf-pla ne who se bo unding line passes thro ugh tw o data p oints. If φ < β < 2 π , then q do es not affect this ha lf-plane and H l contains at least k data p oints a nd k + 1 da ta p oints if its bo unding line pa sses through tw o da ta p oints befo r e and after the dele tio n. Finally , if β = 0 or α ( H l ’s asso ciated vector v H l is either v H 1 or v H 2 ), then q do es not affect this ha lf-plane and H l contains exac tly k + 1 b efore and after the deletion. The num ber of p oints in s ome half-planes ha s decrease d, but the half-space depth of p is still at least k / ( n − 1) so the depth o f p rema ins unchanged. The defining ha lf-planes may change lo cation. B y the lo ca tion pr o p erty , Pr op erty 5, the asso ciated vectors to the new defining half-planes m ust b e in the regions [0 , φ − π ) and ( π , φ ]. By the discussio n ab ove, we can shrink these regions to ( γ , φ − π ) ∪ { 0 } and ( π , γ + π ) ∪ { φ } . B y the counting prop erty , Pr o p erty 3, to lo cate these vectors one needs to traverse the r e g ion from φ − π tow ards γ a nd from π to wards γ + π until the fir st vector whos e a sso ciated half-pla ne passes throug h t wo data po in ts and contains k + 1 data p oints is lo cated in each direction. If none exist, then the defining half- pla nes remain unchanged. By T he o rem 4.1, a t most one defining half-plane w ill change its lo ca tion. 0000000000000000000000 0000000000000000000000 0000000000000000000000 1111111111111111111111 1111111111111111111111 1111111111111111111111 l p l 1 2 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 New defining half−plane depth k φ p q γ φ−π >=k+1 >=k+2 through 2 data points >=k >=k+1 through 2 data points >=k−1 >=k−2 through 2 data points >=k+1 through 2 data points >=k Figure 9. Case 5: The counts of all half-planes when p oint q is deleted fro m region 3. The con tour shown is the old contour of depth k /n . The depth of p decr eases and the half-plane with angle 0 is no long er a defining half-plane. It is the first ha lf-pla ne containing k p oints and whose b oundary passe s thro ug h tw o da ta po int s in the indicated r egion when tr av ersed clo ckwise fro m γ + π to φ . Case 5. P oin t q is dele ted from region 2 or 3 (se e Fi gure 9: q is deleted from one of the defining half-planes . Assume w.l.o.g. that q is deleted from reg io n 3. F or the ins e rtion of data p oint q to end up in reg ion 3 (o r 2 ) it mu st b e inserted into region 4 (Case 3). Insertion into region 4 increa s es the depth o f p and may mov e one of the defining lines into the inside o f the old co n tour. Therefor e a dele tio n will decrease the depth of p . After the deletion, H l 1 will still contain k + 1 data p o int s and have tw o data p oints o n its b oundary ; also , H l 2 will now co nt ain only k data DYNAMIC MAINTENANCE OF HALF-SP ACE DEPTH F OR POINTS AND CONTOURS 19 po int s and hav e tw o data po ints on its b oundar y . Therefore, H l 1 can no longer be a defining half-plane for p . In fact, since q m ust now corres po nd to a p oint in region 4 , H l 1 m ust change to a half-plane co ntaining k p oints and whose b oundar y includes tw o p o int s in the in terv al ( φ, γ + π ]. T o lo cate this vector, traverse the region from γ + π to φ in the clo ckwise direction to find the first v ector whose asso ciated ha lf-plane s a tisfies these conditions . 00000000000000000000000 00000000000000000000000 00000000000000000000000 11111111111111111111111 11111111111111111111111 11111111111111111111111 1 l p 2 l 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 >=k+1 φ p q γ φ−π >=k >=k+1 through 2 data points >=k depth k >=k+1 through 2 data points >=k through 2 data points >=k−1 >=k+2 through 2 data points Figure 10. Case 6: The counts of all half-planes when p oint q is deleted from r egion 4. The contour shown is the o ld contour of depth k /n . The depth of p decr eases and the defining half-planes for p remain unchanged by the co un ting prop erty , Prop erty 3. Case 6. P oint q i s dele ted from region 4 (se e Fi gure 10): q is deleted from b oth defining half- pla nes π < γ < φ . Since b oth H l 1 and H l 2 now co nt ain k po int s and their b ounding lines pass thro ugh tw o data p oints, the depth of p is now ( k − 1 ) / ( n − 1). By the lo cation prop erty , P rop erty 5, the new defining half-pla nes m ust lie in the interv als [0 , φ − π ) and ( π , φ ], with o ne in ea ch interv al. How ever, by the counting pr op erty , P rop erty 3 , every ha lf- pla ne in the int erv al (0 , φ ) whose bo unding line passes through t wo da ta p oints contains ≥ k + 2 data p oints. After the deletion of q , these ha lf-planes contain ≥ k + 1 data p oints. Therefore, they cannot be defining half-pla nes a nd H l 1 and H l 2 m ust remain the defining half-pla nes. Case 7. P oin t q is on a defining l ine (see Fig ure 11) Ther e ar e tw o po ssible cases when q is on a defining line. The tw o cases o ccur if q is in the s ame dir ection from p as the cov er contour edge , see Figure 11(a), or if q is in the opp osite direction as the con tour e dg e, see Figure 11(b). If q lies on the b oundary b etw een regio ns 1 and 2 or regions 1 a nd 3, then q lies in the direction o f the co ntour edge. F or the insertio n of data po int q to end up in this p o s ition on a definition line, it must be ins erted into r egion 2 or 3 (Case 2 ). If q lies on the b o undary b et ween reg ions 2 and 4 or r egions 3 and 4, then q lies in the o pp o site direction from the contour edge. F or the insertion of da ta p o int q to end up in this p osition on a defining line, it must b e inserted into regio n 4 (Case 3 ). In either c a se, the half-plane including q can no longer b e a defining half-plane s ince its b oundar y line passes thro ugh o nly one da ta p oint. In first case, ass ume w.l.o.g. that q lies on the boundary b etw een r egions 1 and 3, see Figure 1 1(a). Then H l 2 is no longer a defining half- pla ne. By undoing 20 MICHAEL A. BURR, EYNA T RAF ALIN, AND DIANE L. SOUV AINE 0000000000000000000000 0000000000000000000000 0000000000000000000000 1111111111111111111111 1111111111111111111111 1111111111111111111111 p l 1 l 2 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 New defining half−plane depth k >=k+1 through 2 data points φ >=k p φ−π q >=k+1 >=k+2 through 2 data points >=k+1 through 2 data points >=k 00000000000000000000000 00000000000000000000000 11111111111111111111111 11111111111111111111111 p l 1 l 2 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 000000000 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 111111111 >=k+1 depth k >=k through 2 data points φ >=k−1 p φ−π >=k >=k+1 through 2 data points q New defining half−plane >=k+2 through 2 data points (a) (b) Figure 11. Case 7: The counts of all half-planes when p oint q is dele ted from a defining half-plane. (a ) The case where q is in the s ame direction as the defining edge and is deleted fro m the bo undary b etw een regions 1 a nd 3. The half-space depth of p remains unchanged, but the defining half-pla ne with angle φ is no longer a defining half-plane. The new defining half-plane is the first half-plane containing k + 1 data po int s and whos e b oundar y passes through tw o data p oints in the counter-clo ckwise direction from π to φ . (b) The case where q is in the oppo site directio n from the defining edg e and is deleted fr om the b o undary b etw een regions 2 and 4. The half-space depth of p decreases , and the defining half-plane with angle φ is no longer a defining half-pla ne. The new defining half-plane is the firs t half-pla ne containing k + 1 data p oints and whose bo undary passes through tw o data p oints in the c o unter-clockwise direction from φ to 2 π . an insertion in to region 3, Cas e 2, w e can loca te the new defining half-plane b y searching in a c o unter-clockwise directio n from π to φ to find the fir st vector who se asso ciated half-plane contains k + 1 data p oints and whose b oundary contains tw o data p oints. In the second case, the depth of p decr eases, and assume w.l.o .g. tha t q lies on the b o unda ry b etw een r egions 2 and 4, see Figure 11(b). Then H l 2 is no longer a defining half-pla ne. By undoing an insertion into reg io n 4, Case 3, we can lo ca te the new defining half-plane by searching in a co un ter-clo ckwise direction fro m φ to 2 π to find the first vector whose as so ciated half-plane co ntains k data p oints and whose b o undary contains tw o da ta p oints. 4.3. Alg o rithm. In this section, we aug ment the data structure presented in Sec- tion 3 to maintain no t o nly the ha lf-space depth of a p oint, but a lso the defining half-planes, pr ovided that the data p oint is not o n a degenera te contour. By in- sp ecting the arg uments in Section 4.2, w e find tha t all that is needed is a sear ch ability to find new defining ha lf-planes, this op eration is describ ed here. Note that although all of the arguments in Section 4.2 as sumed that the cur rent p os itio n of the half-planes ob eyed the co nv exit y prop er ty , Pro pe r ty 1, it is stra ightforw ard to reinterpret a nd r otate the r esults for defining half-planes in arbitra ry po sitions (e.g., a r otation is just a transla tion of the unit circle). DYNAMIC MAINTENANCE OF HALF-SP ACE DEPTH F OR POINTS AND CONTOURS 21 • N ext(T , q , k ), Pre v(T, q , k ) - Given a set of vectors T emana ting from data p oint p , lab eled with Depth , a vector q , a nd a depth v a lue k , rep ort the fir st vector in a counter-clo ckwise or clo ckwise dir ection, resp ectively , after q of Depth k (assuming such a vector exists). 4.3.1. D etaile d Op er ations. • T o p erform a Nex t(T, q , k ) , firs t lo cate the leaf q b y searching the tree, and, while se a rching the tree, upda te the Depth , sub tree- addit ion , minD epth , and ma xDepth fields of the c hildren of the path as the tree is trav ersed. Now, trav erse this path in the reverse direc tio n. F rom b ottom to top, ev- ery time there is a right child o f the pa th that is not on the path, co ns ider its min Depth a nd maxDe pth v a lues. If k is contained in this range, des c end through this tree tak ing the path to the left child w hene ver k is included in the interv al fo r med from its minD epth and maxDe pth v alues and the right child otherwise. If we reach the ro ot of the tree, without finding appro pr i- ate minD epth and maxD epth v alues , let l ef t b e the leftmost leaf in the tr ee and p erform Next(T , lef t , k ) (this step wraps ar ound the brea k b etw een 2 π a nd 0 in the unit circle). T o p e rform P rev(T, q , k ), p er form the same op eration as describ ed ab ov e in Next , but with the r oles of right a nd left reversed. Theorem 4.2. An algorithm exists that c an dynamic al ly maintain the half-sp ac e depth of a data p oint and maintain its defining half-planes, if define d, r elative to a dynamic set of n p oints in O (log n ) time p er op er ation and line ar sp ac e. Pr o of. Maintain the structure presented in Section 3, aug ment ed with the op era - tions fro m this section and up date the defining half-planes using the o pe r ations as describ ed in Sec tio n 4.2  Theorem 4.3 . If p lies on a non-de gener ate c ont our and the defining half-planes for a p oint p ar e kn own, then the new depth of p c an b e determine d when q is either inserte d into or delete d fr om the data set in O (1) time. Pr o of. The cases in Section 4.2 descr ibe all p o ssibilities and can b e decided in by comparing the p o int of interest to the defining half-planes.  Thu s far, we hav e av oided the degenera te cas e. It is p os s ible to chec k whether this case o ccurs using the Ne xt and Pr ev op era tions. W e use the convexit y prop er t y , Prop erty 1, and the counting prop erty , P rop erty 3, to note that if p has depth k /n , then a ll meaning ful ha lf- pla nes with resp ect to p containing k + 1 data p oints and whose b oundary contains 2 data points must hav e ass o ciated vectors lying in a semi-circle. One easy wa y to c heck this is a s follows: Divide the unit cir cle in to four interv als: [0 , π / 2], [ π / 2 , π ], [ π, 3 π / 2], and [3 π / 2 , 2 π ]. Search for the extreme meaningful half-planes in each interv al containing k data points. Then p is on a degenerate co ntour if and only if these vectors do not lie in a se mi- circle. 5. Dynamicall y Upda ting Rank Contours In this section, we keep a co llection of data structure s either fro m Section 3 o r from Sec tion 4 to maintain the depth of each po int a nd then reso rt the data p oints according to their new depth. (There is a choice o f data structur e s becaus e the structures from Sectio n 3 maintain the data necess ary for this algor ithm. Since the 22 MICHAEL A. BURR, EYNA T RAF ALIN, AND DIANE L. SOUV AINE structures fro m Section 4 are a ugmented versions of this data structure, they also maintain the nece ssary da ta.) W e b egin with a simple obse r v a tio n: Observ ation 5. 1. When a data p oint is inse rted into o r deleted fro m a data set, the v a lue of k in each p oint’s depth, k /n , can increase o r decrease by a t mo st 1 step; i.e., for an inse r tion the new ha lf-space depth is either k / ( n + 1) o r ( k + 1) / ( n + 1 ) and for a dele tio n, the new half-spa ce depth is either k / ( n − 1) o r ( k − 1) / ( n − 1). The re-so r ting step uses a list of buck ets that hold all data p oints, where buc ket k holds the list o f data p oints o f depth k /n . The list co nt ains buck ets fr o m 0 to ⌊ n/ 2 ⌋ , the ma ximum num ber of co ntours for the curr ent da ta s et. When a new po int is inserted or deleted, every p oint q that changes its depth must b e moved: for example, if a data p oint changes its half-spa c e depth from k ′ /n to ( k ′ + 1) / ( n + 1), then it is r emov ed fr om its old bucket ( k ′ ) and inserted into the new bucket ( k ′ + 1 ). Observ ation 5.1 guara ntees that the depth o f q do es no t change by more then 1 and so the up date takes constant time. The structur e guar antees that the data p oints sorte d by depth can b e retrieved in linear time. T o r etrieve data p oints b y x -c o or dinate , a second copy of the list o f da ta p oints, sorted according to their x -co or dinate and augmented with p ointers to the depth- sorted list, is maintained. Every p oint in the depth-sor ted list is augmented with a p ointer to its buck et, which a llows a co nstant time retriev al of the depth o f any po int and a total running time that is linear in the set size. 5.1. Alg o rithm. Assume p o int q is inserted int o or deleted from the data s et. • Add o r remove, if needed, a buck et to acco un t for the new size of the da ta set. • F or every p oint p ∈ S – Update the data structure ass o ciated with p by incr ement ing or de cr e- menting the n umber of points in eac h of the half-planes containing q – If q was inserted into the data set, up da te p ’s data s tructure by insert ing the tw o vectors asso ciated w ith the meaningful half-planes determined by p a nd q , setting the cor resp onding to fie lds according to the dir ection to q , and la b eling their D epth as the depth asso ciated with their di recti on . The Dept h ca n b e computed by examining the neighboring ha lf-planes’ Depth and t o fields. – If q was deleted from the da ta s et, up date p ’s data structure by Removi ng the vectors ass o ciated with the meaningful ha lf-planes de- termined by q . – Update the depth of p by consider ing the v alue of m inDep th a t the ro ot of the tree. – If the depth of p changed, remov e it fr o m its buck et and place it in the adjacent bucket, a c cording to its new Depth . • If the data structure which was chosen for this a lgorithm is the one fr o m Section 4 then, since this data structure als o maintains the defining half- planes, the defining half-planes must b e up da ted: – Compare q to the defining edges of p , and decide which of the cas e s describ ed in Section 4.2 applies . If needed, lo ca te the new defining edges as describ ed in the ca ses in Section 4.2. DYNAMIC MAINTENANCE OF HALF-SP ACE DEPTH F OR POINTS AND CONTOURS 23 – If p is the unique p o int with ma x im um depth (maximum when c om- pared to the other p oints), then use Next and Pre v to determine if p is on a degener a te contour as descr ibed in Section 4 .2. If p is o n a degenerate ha lf-plane, up date its defining half-planes to b e nul l . – If p was on a degenerate contour, but is no longer on a degener ate contour, then use its da ta structure alo ng with the conv erse counting prop erty , P rop erty 4, to deter mine its defining ha lf-planes. • If q w as inse r ted in to the data set, build its data structure by sorting all vectors aro und q , assigning them the cor rect D epths , computing the half- space depth o f q , and pla cing it in the co rrect buck et. • If q was deleted from the data s et, r emov e it from the c o rrect buck et. This data structure culminates in algorithms for ma int aining the ha lf-space depth of all p oints and the rank- ba sed contours. Theorem 5.1. An algorithm exists that c an c ompute the half-sp ac e depth r anking- or der of a set of p oints dynamic al ly in O ( n log n ) time p er op er ation and quadr atic sp ac e. In addition, any r ank-b ase d c ontour c an b e r ep orte d in O ( n ) time. Pr o of. Note that we do not actually maintain the contours themselves, but a struc- ture to rep o r t a contour efficiently . Theo rem 5 .1 implies that w e can main tain the ranking - order o f all p oints. Since we also hav e kept the data points in order sorted by x -co or dinate and the tw o structures linked, in linear time, we examine each buck et to select the appropriate num b er of deep data p o ints and then run Graham-sca n on these data p oints. In this c ase, s ince the data p oints are already ordered b y x -co ordinate, the Gr aham-scan for the upper and low er con vex hulls takes linear time, see [de Berg et al., 20 0 0].  6. Dynamicall y Upda ting Cover Contours W e pre s ent an algorithm for computing the cov er-based half-spac e depth con- tours o f a set of p oints dynamically in O ( n log 2 n ) time a nd overall qua dratic spa ce. The a lg orithm is indep endent of the half-space depth a nd the rank-ba s ed con- tour a lg orithms. This alg orithm is ba sed on the intersection of half-planes as de- scrib ed in Cor ollary 2.1 and the relations hip b etw een ha lf-plane intersections a nd conv ex h ulls, see [de Ber g et al., 2000, p.245]. Our method is ba sed on the dy- namic computatio n of a c o nv ex hull, a s descr ibe d by Overmars and v an Leeuw en [Overmars a nd v an Leeuw en, 1981]. Througho ut this section, we assume that no two data p oints have the same x -c o or dinate . If tw o p oints hav e the same x - co ordinate, then either the en tire data set ca n b e rota ted so that no t wo p oints hav e the same x -co or dinate or , b ecause the data s e t is in general p o sition, a small (or infinitesima l) p er turbation could b e a pplied to one o f these p oints. 6.1. The Dual Arrangement. The alg o rithm is set in the dual s pace, see [de Berg et al., 2000]: ev ery p oint p = ( p x , p y ) is ma ppe d to the line p ∗ with equatio n y = p x x − p y and every line l g iven by the eq uation y = mx + b is mapp ed to the p oint l ∗ with co ordinates ( m, − b ), see Fig ure 12. The dual tr ansformatio n op eration is called T , a nd the dual tra nsform has the following prop er t y: it pres e rves ordering , so if the p oint p is ab ov e the line l , then the line p ∗ is b e low the po int l ∗ by the same vertical distance. This transfo rmation is useful b ecause the half-pla ne int ersec tio n problem is dua l to the conv ex hull pr oblem. Corollary 2.1 shows that in order to 24 MICHAEL A. BURR, EYNA T RAF ALIN, AND DIANE L. SOUV AINE maintain the cov er-ba sed depth co nt our o f depth k /n , we should int ersec t all half- planes co nt aining n − k + 1 data p oints and whose b ounding line pas s es thro ugh t wo p oints. W e b egin by div iding this intersection in tw o, by conside r ing the s ub- set of these half-planes that op en upw ards and the subset of these ha lf-planes that op en down wards. In this discussion, w e o nly co nsider the set of half-pla ne s that op en down w ards be c ause the set that op en upw ards can b e tr e ated similarly . W e know that the in tersectio n of these ha lf-planes cor resp onds to an upp er conv ex hull problem in the dua l. W e descr ibe this hull next. In the primal, ea ch of the half-planes of in terest is a half-plane that is ab ov e n − k + 1 p oints and whose bo unding line passes through tw o data p oints. F or such a half-plane, the bo unding line is s tr ictly a bove n − k − 1 p oints. A line that pas s es through tw o da ta p oints co rresp onds, in the dua l, to the intersection p oint h of tw o lines dua l to data p oints. Since the b ounding line was strictly ab ov e n − k − 1 data po int s, h is a p oint strictly b elow n − k − 1 lines dual to da ta p oints, see Figur e 12. Also, any intersection p oint of tw o dual lines that is strictly b elow n − k − 1 dual lines corr esp onds to a half-pla ne containing n − k + 1 data p oints, whose b ounding line passes through two da ta p oints, and which op ens down ward. Ther efore, what is needed to compute the intersection o f half-planes in the primal is the upp er conv ex hu ll of these intersection po int s in the dual. A B C D E F G ⇔ T(A) T(C) T(E) T(F) T(G) T(D) T(B) (a) (b) Figure 12. (a) A set of 7 po ints in the primal pla ne and (b) the corresp onding set o f lines in the dual plane under the dual transformatio n T where the p oint p = ( a, b ) is tak en to the line y = ax − b . In the dual plane, the dashed lines trace o ut the fir st and seven th levels (from top to bottom, resp ectively) while the dashed-dotted lines tra ce out the second and sixth levels (from top to b o ttom, resp ectively). T he highlig ht ed line in the primal, which passes through p oints D and E , defines tw o ha lf-planes. T his line has thre e po ints str ic tly ab ov e it and tw o p o in ts strictly b elow it. In addition, this line cor resp onds to dot at the intersection o f T ( D ) and T ( E ) in the dual. This dot has the tw o lines cor resp onding to F and G ab ov e it while it has the thr e e lines co rresp onding to A , B , a nd C b elow it. DYNAMIC MAINTENANCE OF HALF-SP ACE DEPTH F OR POINTS AND CONTOURS 25 In orde r to keep track of a ll of these in tersection p oints with n − k − 1 lines strictly ab ove them, we lo ok to the ( n − k + 1)th level o f the dual arrang ement (the levels a re num bere d star ting with 1). The ( n − k + 1)th level is the clo sure o f the s et of all segments that hav e n − k lines ab ov e them, se e Figure 12. The level consists of segments a nd intersection p oints. F o r any p o int on a segment, there ar e exactly n − k lines ab ove it. F or any in tersectio n p oint, there are either n − k o r n − k − 1 lines strictly ab ove it. Moreover, every intersection po int with n − k − 1 lines stric tly ab ov e it app ears on level n − k + 1. Finally , the upp er hull o f the intersection p oints on level n − k + 1 is almost the upper hull o f a ll in tersectio n p oints with n − k − 1 lines strictly ab ov e them. The o nly cav eat is tha t the endp o ints, i.e., the first and last po int s o n the hull could hav e n − k lines ab ov e them. This can b e check ed eas ily by considering the slop es o f the tw o intersecting lines. If the slop es o f the se g ments on the level increases, then there a re n − k − 1 line s strictly ab ov e the intersection p oint and if the slo p e de c r eases, then ther e are n − k lines strictly ab ove the intersection po int . Therefor e, our algo rithm will maintain the upper hulls (and similarly , the low er hulls) o f e a ch level, which will determine the cover-based contours. 6.2. Basi c Data Structure. The alg orithm uses a data structur e for up dating the convex hull o f a set of p oints dyna mically in O (lo g 2 n ) p er upda te and in linear ov erall space from [Overmars and v an Leeuw en, 1981; Dobkin and So uv aine, 19 87]. In particula r, w e maintain each level o f the arrangement of lines in the dual in such a data structure. The ma int enance of the convex hull provides the co nt ours as describ ed ab ov e in Section 6.1. In this section, we will call a co nnected comp onent of a n arra ng ement where the x -co ordinates of the vertices are increa sing a chain ; a level of a n ar r angement is an example of a chain. O ur o p erations, given a da ta s et, are as follows: • S plit( T, p ) - Given a chain T from an arrangement a nd a data p oint p , compute the ch ains asso ciated with the p oints to the left and right of p . This op eration was pa rt o f the o riginal data structur e of Overmars et al. • J oin(T 1 , T 2 , p ) - Given tw o chains T 1 and T 2 such that for every point p 1 ∈ T 1 and p 2 ∈ T 2 , xcoord ( p 1 ) < xcoor d ( p ) < xcoord ( p 2 ). Compute the chain that connects the tw o chains T 1 and T 2 via p . This op eration was not needed for the dy namic up date of a single conv ex hull and c annot b e used for joining general hulls, but, in this case, the ordering of v ertices of the chains allows for this op er ation. 6.2.1. D etaile d Op er ations. O ur implementation uses a red-bla ck tree augmen ted with the o p erations of a concatena ble queue to enable a dditional dynamic op er ations to the data structure not re quired by the dynamic conv ex hull or iginal alg o rithm: • A Spli t(T, p ) is p erformed in O (log 2 n ) time as in O vermars et al. : Start from the ro ot a nd descend down the sea rch path towards no de p , in each no de the partial hull is disassembled and rea s sembled at its 2 children. After the hull has b een split, the tree itself ca n b e split and each p ortion can b e rebala nce d by lo c a l changes. • A Joi n(T 1 , T 2 , p ) is p erformed in O (log n ) time. If the black-no de height of tree T 2 is less than the black-node heig h t of the tree T 1 . Then T 2 is added as a subtree of T 1 . After the trees hav e b een joined, the partial hulls alo ng the pa th o f the jo in ar e then rebuilt. 26 MICHAEL A. BURR, EYNA T RAF ALIN, AND DIANE L. SOUV AINE 6.3. Alg o rithm. O ur alg o rithm computes the co nt ours by computing the upper and low er conv ex hulls of the intersection p oints along the levels. Each in tersectio n po int is defined using the tw o lines o f the arra ngement that create the intersection. Two dynamic trees maintain the upper and low er conv ex hulls fo r every level of the arrang ement, 2 n trees for all levels and total of O ( n 2 ) space, the s iz e of the entire arrang ement. When a new p oint q is inserted into o r deleted from the da ta set, some of the dual lev els, the ones in tersected by the line T ( q ), and consequently some of the conv ex h ulls o f these levels, are affected. W e compute the new con vex hulls by upda ting the convex hull trees. 6.3.1. In sertions. Giv en a data p o int q (and its dual T ( q )), a set of n p oints F n , and its asso cia ted data structures, we wish to recompute the half-space depth contours of F n ∪ { q } . After each inser tio n, each old level k , intersected by T ( q ), splits b etw een levels k a nd k + 1. Therefore , the new level k b eco mes a combination o f chains from old level k that remain in level k plus chains from old level k − 1 that increa s e level to level k minus chains from old level k that increase level to level k + 1. In every stitchin g p oint b etw een these c hains, a segment of T ( q ) is added. Not all levels are necessar ily up dated, only those int erse c ted by T ( q ), i.e., the old levels b etw een k ′ + 1 a nd n − k ′ are affected, wher e the ha lf-space depth of q is k ′ /n b efor e the insertion. Since T ( q ) intersects the arr angement exactly n times, O ( n ) chains mov e betw een all tr ees a nd n seg men ts from T ( q ) are a dded. T o update the contours prop er ly , w e need to s titc h the chains corre c tly . The stitchin g is done by splitting the dyna mic trees repr esenting the chains and merging the s ubtrees, while maintaining a cor rect r e presentation of the conv ex hull on the ro ot of ea ch tree. 6.3.2. D etaile d Op er ations. • Co mpute the in tersectio n p oint o f T ( q ) with every line l of the arra ngement and s o rt them acco rding to x co or dinate. Since there ar e only n other lines (and n intersections), this s tep ta kes O ( n log n ). • Sta rt a new chain with the leftmost s egment o f T ( q ), at the level corresp o nd- ing to the o rder s tatistic of the slop e T ( q ) with resp ect to the a rrang ement . • Inc r ement all le vels a bove this new level by 1. • Find all of the se gments of T ( q ), and find the arrang ement each will join when q is added to the data set. This can b e done in O ( n ) time since the difference in the level b etw een tw o sequential s egments is ± 1 . The choice of ± is deter mined comparing the slop es o f the t wo lines at the intersection. • Co nstruct the new set o f levels by splitting and jo ining tre es, and inserting segments of T ( q ): Starting with the new level consisting of the leftmost segment of T ( q ), for ea ch se g ment o f T ( q ), in or der, Spl it the appr opriate chain at the intersection p oint (the rig ht endp oint of the segment). Next, Join the top tw o chains and the bottom t wo chains at the split point. Finally , Join the remaining chain to the next segment of T ( q ). Contin ue this until there a re no more s egments o f T ( q ) to attac h. This step takes O (log 2 n ) for each Split and J oin , and there are a tota l of O ( n ) of these steps (there are a cons ta nt num b er of steps for each se g ment of T ( q )). This results in a tota l time c o mplexity fo r the alg orithm of O ( n log 2 n ). DYNAMIC MAINTENANCE OF HALF-SP ACE DEPTH F OR POINTS AND CONTOURS 27 T(A) T(B) T(C) T(E) T(F) T(G) T(D) 3 4 5 6 7 6 5 T(D) T(A) T(B) T(C) T(E) T(F) T(G) (a) (b) T(D) T(A) T(B) T(C) T(E) T(F) T(G) T(D) T(A) T(B) T(C) T(E) T(F) T(G) (c) (d) Figure 13. (a) The six levels of the arrangement b efore the ar- rangement is augmented with T ( C ). (b) T ( C ) has b een sub divided where it intersects the other lines of the ar rangement. Each interv al (or ray) has b een lab eled a ccording to its level in the new ar range- men t. The new level 3 has b een s ta rted at T ( C ). (c) When the new level 3 intersects the old level 3, the chains switch s o the right part of the old level 3 is stitc hed to the new level 3 and the left part o f the old level 3 b eco mes new level 4. In addition, the next segment along T ( C ) is stitched to the new level 4. (d) When the new level 4 intersects the old level 4, the chains switch in a s imilar manner a s to the stiching in (c). The next step will be to sw itch the new level 5 and the o ld level 5. 6.3.3. D eletions. Given a set o f p oints F n , its asso ciated data structur es, and a data po int q (and its dual line T ( q )) we wish to reco mpute the structure asso ciated with F n \ { q } . When a line T ( q ) is r emov ed from the arrang ement, level k splits betw een levels k and k − 1. Similar to the insertio n case, the stitching of the levels must b e done appropria tely , while maintaining a c o rrect representation of the conv ex hull at the ro ot of each tree. 6.3.4. D etaile d Op er ations. • Co mpute the in tersectio n p oint o f T ( q ) with every line l of the arra ngement and s o rt them acco rding to x co or dinate. Since there ar e only n other lines (and n intersections), this s tep ta kes O ( n log n ). • Find all of the se gments of T ( q ) in the ar rangement, and find the level ea ch will leave when q is removed from the data set. This can b e done in O ( n ) time since the difference in the level b etw een tw o sequential seg men ts is 28 MICHAEL A. BURR, EYNA T RAF ALIN, AND DIANE L. SOUV AINE ± 1. T he choice of ± is determined by compar ing the slop es of the lines a t the intersection.- O ( n ). • Co nstruct the new set of levels by s plitting a nd merging trees, and r emoving segments o f T ( q ): Star ting with the level consis ting of the leftmost segment of T ( q ), for ea ch seg ment o f T ( q ), in or de r , Spl it b oth chains a t the in- tersection p oint (the right endp oint of the segment). Next, Jo in the tw o chains which do not involv e segments o f T ( q ). Discard the chains consis ting only of segments o f T ( q ). Contin ue this until there are no mor e segments of T ( q ) to discar d. This step takes O (log 2 n ) for each Spli t a nd Jo in , and there are a to tal of O ( n ) of these steps (there are a constan t n umber of steps for each segment of T ( q )). This results in a total time complexity for the a lgorithm of O ( n log 2 n ). • Decr ement all levels which s tarted b elow the leftmost seg ment of T ( q ). Theorem 6.1. It is p ossible to c ompute the c over-b ase d half-sp ac e depth c ontours dynamic al ly in O ( n log 2 n ) time p er up date and O ( n 2 ) over al l sp ac e. Mor e over, any c ont our c an b e r ep orte d in O ( m ) time, wher e m is c omplexity of the c orr esp onding levels in the arr angement. Pr o of. Note that we do not actually maintain the contours themselves, but a struc- ture to rep o r t a contour efficiently . In order to compute the cov er-bas ed contour of depth k / n , take the upp er hull o f the ( n − k + 1)th le vel and the and the low er hull of the k th level, r emoving the endp oints if they are not appropr iate, a nd returning these to the primal, wher e they repr e sent the intersection of half-planes containing n − k + 1 data points and whose bounding line passes through tw o data p oints. Finally , the intersection of tw o con vex regio ns needs to b e per formed, which can be done in the complexit y of the hulls b ecause the h ulls are naturally so rted b y slop e, which corres p o nds to b eing so r ted by x -co or dinate in the pr imal plane. The conv exity of the hulls is b ounded by the conv exity o f the levels themselves.  7. Con clusion In this pap er, we provided data structures and alg orithms for dynamically com- puting half-space depth of p o ints as well as rank-ba sed a nd contour-based c ontours. The depth o f a single p o int can b e maintained in O (lo g n ) time p er up date using ov erall linear space. The ra nk-based contours can be maint ained in O ( n log n ) time p er update using ov erall quadr atic space. The c ov er-based contours ca n b e maintained in O ( n log 2 n ) time p er up date using ov era ll quadratic s pa ce. In additio n, we studied the loca l cov er-ba s ed con tours near data po int s and describ ed how they change a s data p o in ts are added or deleted fro m the data set. In this direction, we pr ov ed a result of indep endent interest that at least one lo cal cov er-based contour edge do es at a p oint do es not change a s points are inserted int o or deleted from the data s et. W e end with the op en pro blem of finding additional dynamic algo rithms for other data depth functions as desir ed by the probability a nd statistics communit y , [Liu, 2003]. One w ould ex p ect that this pro blem may b e significantly harder than its half-space depth counterpart b ecause most other da ta-depth functions are not as well-behav ed, in the finite sample cas e s, has half-s pa ce depth, see [Zuo a nd Serfling, 2000; Burr et al., 200 6]. DYNAMIC MAINTENANCE OF HALF-SP ACE DEPTH F OR POINTS AND CONTOURS 29 References Timothy G. Abbo tt, Michael A. Burr, Timothy M. Chan, Erik D. Demaine, Mar- tin L. Demaine, John Hugg , Daniel K ane, Stefan La ngerman, Jelani Nelso n, Eynat Rafalin, K athryn Se y bo th, a nd Vincent Y eunga. Dyna mic ham-sandwich cuts in the plane. Computational Ge ometry , 4 2(5):419 – 428, 2009. Pank a j K. Agarwal and Ji ˇ r ´ ı Ma to u ˇ sek. Dynamic half-space r ange r ep orting a nd its applications. Algorithmic a , 13(4 ):325–3 45, 1995 . Pank a j K. Agarwal, Micha Sharir, a nd Emo W elzl. Algo rithms for center and tverberg p o ints. ACM T r ansactions on Algorithms , 5(1), 20 08. Greg Aloupis. Geometric measur es of da ta depth. In Liu et al. [20 06], pag es 1 4 7– 158. Greg Aloupis, Carmen Co rt´ es, F rancisco G´ omes, Michael Soss, a nd Go dfried T ou- ssaint. Low er b ounds for computing statistica l depth. Computational Statistics & Data Analysis , 40(2 ):223–2 29, 20 02. Vic Ba rnett. The or dering of m ultiv aria te data. J ournal of t he R oyal Statistic al So ciety. Series A (Gener al) , 13 9(3):318 –355, 19 76. David Bremner , Dan Chen, Jo hn Iacono, Stefan Langerman, and P at Mor in. Output-sensitive algorithms for tuk ey depth and rela ted problems. St atistics and Computing , 18 (3):259–2 66, 2 008. Michael A. Burr , Eynat Rafalin, a nd Diane L. Souv aine. Simplicial depth: An im- prov ed definition, analysis, a nd efficiency for the finite sample ca s e. In L iu e t a l. [2006], pages 19 5–20 9. Timothy M. Chan. An optimal ra ndomized algor ithm for max im um tukey depth. Symp osium on Discr ete Algorithms , pages 4 30–43 6, 20 04. Richard C o le. Slowing down so rting netw ork s to obta in faster so rting algorithms. Journal of the ACM , 34(1 ):2 00–20 8, 1987 . Richard Cole, Mic ha Shar ir, and Chee K. Y ap. On k-hulls and re lated pro blems. SIAM Journ al on Computing , 16(1 ):61–77 , 1987 . Mark de Berg, M. v an Kre feld, M. Overmars, and O. Sch warzk opf. Comp utational Ge ometry: Algori thms and Applic ations . Springer , 2nd edition, 20 00. David Dobkin and Diane Souv aine. Co mputational geometr y – a user’s g uide. In Jacob T. Sch wartz and Chee- Keng Y ap, editor s , Algorithmic and ge ometric as- p e cts of r ob otics , volume 1 of Ad vanc es in R ob otics , chapter 2. Lawrence Erlba um Asso ciates Inc., Hillsda le , NJ, 19 87. J ¨ urgen Eckhoff. Helly , ra don, and cara th´ eo dory type theo rems. In Grub er and Wills [1993], pages 38 9–44 8. W. F. Eddy . Co n vex hull p eeling. In COMPST A T 1982: Pr o c e e dings in COmpu- tational St atistics, Part 1 , pages 42– 47. Physica-V erlag, 1982. Herb ert Ede ls brunner and Emo W elzl. Co nstructing b elts in tw o-dimensional a r - rangements w ith applications. SIAM J ournal on Co mputing , 15 (1):271– 284, 1986. Christo doulos A. Floudas and Panos M. Pardalo s, editors . F r ontiers in Glob al O p- timization , volume 74 of Nonc onvex Optimization and Its Applic ations . Springer, 2003. Komei F ukuda a nd V era Ros ta . Exact parallel algor ithms for the lo ca tion depth and the maximum feasible subsystem pro blems. In Flouda s and Pardalo s [200 3], pages 12 3–13 3. 30 MICHAEL A. BURR, EYNA T RAF ALIN, AND DIANE L. SOUV AINE Peter M. Grub er and J¨ org M. Wills, editors. Handb o ok of Convex Ge ometr y . North- Holland, Amsterda m, 19 93. Joseph L. Ho dges. A biv a riate sign test. A nnals of Mathematic al Statistics , 26(3): 523–5 27, 1 9 55. Shreesh Jadhav and Asis h Mukhopadhya y . Computing a centerp oint of a finite planar set of p oints in linear time. Discr ete & Computational Ge ometry , 12(3 ): 291–3 12, 1 9 94. T ed Jo hns on, Ivy Kwok, and Raymond Ng. F ast co mputation of tw o-dimensiona l depth contours. The F ourth International Confer enc e on Know le dge Disc overy and Data Mining , pages 22 4 –228 , 1998 . Shank ar K rishnan, Nabil H. Mustafa, and Suresh V enk a tasubramania n. Hardware- assisted computation o f depth contours. Symp osium on Discr ete Algorithms , pages 55 8–56 7, 200 2. Stefan Langer man and William L. Steiger . Computing a ma ximal depth po int in the plane. Pr o c e e dings of the Jap an Confer enc e on Discr ete and Computational Ge ometry , 20 00. Stefan Lang e r man and William L. Steiger. Optimization in a rrange ments. In Pr o- c e e dings of t he 20th Annual S ymp osium on The or etic al Asp e cts of Computer Sci- enc e , volume 260 7 of L e ctu r e Notes In Computer Scienc e , pages 5 0–61, 20 03. Regina Liu. P ersona l communication, May 20 03. Regina Liu, Robe rt Serfling , and Dia ne Souv aine, editors. Data Depth: Ro bust Multivariate Analysis, Comp utational Ge ometry and Applic ations , volume 72 of DIMACS Series in Discr ete Mathematics and The or etic al Computer Scienc e . American Ma thematical So ciet y , 20 06. Regina Y. Liu, Jesse M. Parelius, a nd Kesa r Sing h. Multiv ariate analys is by da ta depth: descriptive statistics, graphics and inference . Annals of Statistics , 2 7(3): 783–8 58, 1 9 99. Ji ˇ r ´ ı Matou ˇ sek. Computing the center of pla nar p oint sets. In Discr et e and Compu- tational Ge ometry: Pap ers fr om the DIMACS Sp e cial Y e ar , volume 6 of DIMACS Series in Discr ete Mathematics and The or etic al Comp uter Scienc e , pages 2 21– 230. America n Mathematica l So ciety , 199 1. Kim Miller , Suneeta Ramaswami, Peter Rousseeuw, J. Antoni Sellar` es , Diane So u- v aine, Ilea na Streinu, and Anja Struyf. Efficie nt co mputation of lo ca tion depth contours by metho ds of computational geo metry . J ournal Statistics and Com- puting , 13 (2):153– 162, April 20 0 3. Mark H. Ov ermar s and Jan v an Leeuw en. Ma int enance of configuratio ns in the plane. Journal of Computer and S ystem Scienc es , 23(2):16 6–204 , 198 1. Eynat Rafalin a nd Diane L. Souv aine. Data depth co nt ours - a computational geometry p ers pec tive. T ec hnical Rep ort 2, T ufts Universit y , Computer Science Department, May 20 04. Peter J . Rousseeuw a nd Anja Struyf. Computing lo cation depth and re g ression depth in hig her dimensio ns. Statistics and Computing , 8 (3):193– 203, 1 998. Peter J. Rousseeuw, Ida Ruts, a nd Jo hn W. T ukey . The bagplot: a biv ar iate boxplot. The Americ an Statistician , 53(4):38 2–38 7, 1999. Ida Ruts a nd Peter Rousseeuw. Biv ariate lo ca tio n depth. Applie d statistics , 45(4): 516–5 26, 1 9 96a. Ida Ruts a nd Peter Ro usseeuw. Constructing the biv ariate tukey median. Statistic a Sinic a , 8(3 ):8 27–83 9, 19 98. DYNAMIC MAINTENANCE OF HALF-SP ACE DEPTH F OR POINTS AND CONTOURS 31 Ida Ruts and Peter Rouss eeuw. Computing depth contours of biv a r iate p oint clouds. Computational S tatistics & Data Analysis , 23 (1 ):153–1 68, 1996 b. Anja Struyf and Peter J . Rousseeuw. High-dimens io nal computation of the deep est lo cation. Computational Statistics & Data Analysis , 34(4):41 5–426 , 200 0. John W. T ukey . Mathematics a nd the pictur ing of data. In Pr o c e e dings of the International Congr ess of Mathematicia ns (V anc ouver, B. C., 1974) , volume 2 , pages 52 3–53 1, Montreal, Queb ec, 197 5. Canadia n Mathematica l Cong r ess. Marc v an Kr e veld, Joseph S. B. Mitchell, P eter Rousse euw, Micha Sharir, Jack Sno eyink, and Bettina Sp eckmann. E fficient algo r ithms for maximum reg ression depth. Symp osium on Computational Ge ometry , pa ges 31–4 0, 1 999. Yijun Zuo and Ro b er t Ser fling. Structural pro p erties a nd conv ergenc e results for contours o f sa mple sta tis tica l depth functions. The Annals of S tatistics , 28(2 ): 483–4 99, 2 0 00. Dep a r tm ent of Computer Science, Tuf ts University, Medford, MA 0 2155, US A Curr ent addr ess : Mathematics Department, F ordham Universit y , Bronx, NY 10458. E-mail addr ess : burr@cims.nyu. edu Dep a r tm ent of Computer Science, Tuf ts University, Medford, MA 0 2155, US A Curr ent addr ess : Google Inc., 1600 Amphitheatre Parkwa y , Moun tain View, CA 94043, USA E-mail addr ess : eynat.rafalin@ alumni.tufts.edu Dep a r tm ent of Computer Science, Tuf ts University, Medford, MA 0 2155, US A E-mail addr ess : dls@cs.tufts.e du

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment