18

Incremental FO( +, \u003c ) Maintenance of All-Pairs Shortest Paths for Undirected Graphs after Insertions and Deletions

  • Upload
    wright

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Incremental FO(+; <) Maintenance of All-PairsShortest Paths for Undirected Graphs afterInsertions and DeletionsTo appear in ICDT99Chaoyi Pang, Ramamohanarao Kotagiri, and Guozhu DongDepartment of Computer Science, The University of Melbourne, Parkville 3052,Australia, fchaoyi, rao, [email protected]. We give incremental algorithms, which support both edge in-sertions and deletions, for the all-pairs shortest-distance problem (APSD)in weighted undirected graphs. Our algorithms use �rst-order queries, +(addition) and < (less-than); they store O(n2) number of tuples, wheren is the number of vertices, and have AC0 data complexity for integerweights. Since FO(+; <) is supported by almost all current databasesystems, our maintenance algorithms are more appropriate for databaseapplications than non-database query type of maintenance algorithms.Our algorithms can also be extended to duplicate semantics.1 IntroductionFinding shortest-path information in a graph is one of the most commonly en-countered problems in the study of transportation and communication networksand has applications in communication systems, scheduling, computation of net-work ows, and in the context of document formatting etc. Since shortest-pathinformation can be used for routing in a communication network, the possibilityof changes to the network, say due to a link failure or a new link being added tothe service, makes the incremental shortest-path problem relevant to routing.Problem statement:We consider the incremental maintenance of the all-pairsshortest distance (which is called the distance problem) in undirected graphsafter an edge insertion and an edge deletion. We only consider single edge inser-tion and single edge deletion operations as the unit changes to the graph. Anydistance-modi�cation on an edge could be accomplished through �rst deletingthe edge then followed by adding a new edge with the modi�ed distance betweenthe same vertices.Contributions: We start from the incremental maintenance algorithm for theall-pairs shortest-distance problem with positive distance on each edge (APSD >0), then extend the maintenance result to the all-pairs shortest-distance prob-lem with non-negative distance on edges (APSD � 0). A \restricted" reductionresult between the APSD > 0 case and the APSD � 0 case is then given. Our

maintenance algorithms for the distance problem can be applied to maintain thetransitive closure problem in undirected graphs.In undirected graphs, the restriction of \non-negative distance" makes eachshortest walk between two vertices being a shortest path between the same twovertices. The presence of negative-distance edges implies that shortest walks canbe unbounded.For the distance problem, our algorithms use �rst-order queries with addition\+" and less-than \<" operations (FO(+; <)) to maintain the shortest distancedynamically in undirected graphs after each edge insertion and edge deletion.The time complexity of our algorithms are dominated by \+" and \<" oper-ations (with an upper bound of NC1). When the distance of each edge in thegraph is an integer, our algorithms have AC0 data complexity [11] (the classof problems that can be solved using polynomially many processors in constanttime). To the best of our knowledge, no AC0 incremental algorithms (even fornon-FO algorithms), supporting both edge deletions and edge insertions, forgeneral undirected graphs are previously known. Our algorithms are the �rstof this kind. Since FO(+; <) is supported by almost all current database sys-tem, our incremental maintenance algorithms are more appropriate for databaseapplications than non-FO incremental algorithms. For the maintenance of thetransitive closure problem, we keep the \shortest length" (the number of edgeson the shortest paths). Our algorithms use simple data structures. The absenceof recursion in our algorithms makes additional optimizations possible, as a rangeof optimization techniques to evaluate relational database queries can be appliedto our algorithms. The optimization of recursive queries is signi�cantly harderthan that of relational queries.All our algorithms employ one common technique as the basis for the main-tainability results for an edge deletion: They �rst delete a set of tuples whoseexistence in the relation depends on the deleted edge; this step may delete morethan necessary. Then they correct the wrong deletions by doing the relationalnatural join of the result of the �rst step with the modi�ed graph up to two times.This generalises the technique used in [5] for the maintenance of the transitiveclosure of acyclic digraphs.Although all the maintenance results in the paper are stated for the setsemantics, they can be easily extended to the bag semantics (multiset).Related Works: [9] gives a full dynamic algorithm which requires O(n2) se-quential time for an edge insertion and/or an edge cost decrease, and O(mn +n2 logn) time for an edge deletion and/or an edge cost increase, where n is thenumber of vertices and m is the number of edges in the graph. The algorithm in[1] is for graphs with nice topologies such as trees and outerplanar graphs. [4]achieves logarithmic query and update times for planar digraphs through graphdecomposition. [10, 12] also consider planar graphs. These previous dynamic al-gorithms and batch algorithms for the APSD problem use elaborate data struc-tures and need a recursive mechanism. Since most commercial database systemsare relational database systems, which do not directly support recursion, a more

powerful host language is needed for those algorithms to maintain the APSDviews.Given a recursive query, the non-recursive incremental evaluation approachuses non-recursive programs to compute the di�erence of the answers to thequery against successive databases between updates. The mechanism used inthis approach is called a \First-Order Incremental Evaluation System" in [7]and \Dyn-FO" in [14]. For undirected graphs, reachability, connectivity, bipar-titeness and the minimum spanning forests problems have �rst-order incrementalalgorithms for edge insertion and edge deletion [6, 14]. [8] considers maintainingviews de�ned by constrained transitive closure queries in directed graph withweights but for insertion only.Comparing the algorithms of [6, 14] with ours for the transitive closure prob-lem in undirected graphs, their algorithms are based on the maintenance of span-ning forests of the given undirected graph while ours are not. Our algorithms arestructurally simple and do not need to maintain the order of edges, a successorrelation on all vertices. The algorithms based on maintaining spanning forestsare hard to convert to solve the APSD problem since the set of all edges on theshortest paths does not necessarily have a \tree-like" structure and, therefore,a single modi�cation to the undirected graph may cause the reconstruction ofO(jV j) number of spanning trees (where V is the set of vertices of the graph).Our algorithms also have a unifying scheme of computation, for transitive clo-sure in undirected graphs, in acyclic digraphs [5], and for the APSD > 0 (orAPSD � 0) problem in undirected graphs.Our algorithms are in FO(+; <), using \+" and \<" to add and select theminimum length of paths. The storage demands of our algorithms stay withinthe same order of magnitude as the algorithm of [6].As Spira and Pan [17] show, for directed graphs, the batch all-pairs shortest-distance problem can, in some sense, be reduced to the problem of updatingthe solution to the all-pairs shortest-distance problem after an edge deletion.[17] says an incremental algorithm that saves only shortest-distance informationcannot, in the worst case, do any better than a batch algorithm. Our resultsshow the statement is not true for the APSD > 0 problem in undirected graphs.Organisation: We de�ne some notations in Section 2. In Section 3 we giveour incremental algorithm for the distance problem in undirected graphs witheach edge having a positive distance. Section 4 extends the maintenance result ofSection 3 to the undirected graph with each edge having a non-negative distance.Section 5 shows that the APSD � 0 problem can be maintained in the same wayas that of APSD > 0 under certain restrictions and gives a reduction betweenAPSD > 0 and APSD � 0. Section 6 presents some concluding remarks andadditional applications of our results.

2 PreliminariesWe assume the reader is familiar with the �rst-order logic (or the relationalcalculus). In this section we present some relevant standard terminology of graphtheory.An undirected graph G = (V;E) consists of a �nite set of vertices V anda set of edges E such that E � f(u; v)ju; v 2 V g, where (u; v) is viewed as anunordered pair. Suppose each edge e of G has a distance, which is denoted asdist(e). For example, dist(e) may represent the \weight" of edge e or the timespent to travel between City a and City b where e = (a; b).In this paper, all graphs mentioned are undirected graphs. We will denote\edge e = (a; b) is in G" simply by G(a; b) (or G(e)).An edge e can be inserted to (or deleted from) a graph G. We use G+e andG+ e to denote G [ feg and use G�e and G� e to denote G� feg.A sequence u0u1:::un (n > 0) of vertices in G is a walk (between u0 and un)if (ui�1; ui) is in G for each i 2 [1::n]; the sequence is a path if it is a walk andui 6= uj for all 0 � i < j � n such that i 6= 0 or j 6= n. We say uiui+1:::uj�1ujis a subpath of u0u1:::un for all 0 � i < j � n; when i 6= 0 or j 6= n, we call theformer path a real subpath of the latter path. The distance of a path (or a walk)p (denoted as dist(p)) is de�ned as the sum of dist(e) of all edges e on the path(or walk). The length of a path (or a walk) p (denoted as length(p)) is de�ned asthe number of edges on the path (or walk). Two vertices x and y of G is said tobe reachable if there exists a path between x and y in G.The shortest-distance (shortest-length, respectively) path (or walk) betweenvertex x and vertex y is a path (or walk) between x and y with minimum distance(length, respectively). If there is no path between two vertices then the distance(length) is de�ned to be in�nity. A shortest path is a path which has the shortestdistance.We sometimes need to emphasise an ordering of the vertices on a path. Wesay a path (or walk) p (between vertex u and v) is from vertex u to vertex v toimply that p is in the order of u:::v, and we say a path (or walk) p from u to vgoes through edge e = (a; b) in the order of ab to imply that p has the form ofp = u:::ab:::v.The all-pairs shortest-distance (APSD) problem (the distance problem forshort) is to �nd the shortest distance between every pair of vertices in a graph.A restricted form of the APSD problem is the APSD > 0 (APSD � 0, respec-tively) problem which restricts each edge in the graph to a positive (non-negative,respectively) distance. We will discuss the APSD > 0 (APSD � 0, respectively)problem when the underlying graph is undirected and, as such, any edge inser-tion and distance-modi�cation for the undirected graph preserve the property ofeach edge having a positive (non-negative, respectively) distance.The all-pairs shortest-path (APSP) problem (the path problem for short) isto �nd the shortest path between every pair of vertices in the graph.We will usually maintain relations SPG or SPDG for each undirected graphG.SPG is de�ned as f(x; y; d)j a shortest path between x and y in G has distancedg. SPG(x; y; d) is true if and only if the shortest path between x and y in

G has distance d. We assume SPG(u; u; 0) holds for each vertex u of G andSPG(x; y;1) (1 can expressed by a null value in the database) holds if thereis no path between vertex x and vertex y. Similarly to SPG, we de�ne SPDGto be f(x; y; l; d)j the shortest paths between x and y in G have distance d andthe least number of edges on all such shortest paths is lg. SPDG(x; y; l; d) istrue if and only if (i) the shortest paths between x and y in G have distance dand (ii) one shortest path between x and y in G passes l number of edges andall other shortest-paths between x and y in G pass no less than l number ofedges. When there is no path between vertex x and vertex y in G, we assumeSPDG(x; y;1;1) holds.In an undirected graph G with non-negative distance edges, for each vertex uof G, we de�ne SPDG(u; u; 0; 0). Clearly, SPDG(x; y; 0; d) implies (d = 0)^ (x =y). However, SPDG(x; y; l; 0) does not necessarily mean l = 0 or x = y.For each binary relation R, we let bR = R [ f(u; u)ju is a vertex in Rg.Clearly, in an undirected graph G, if SPG(u; v; d) (SPDG(u; v; l; d), respec-tively) holds then SPG(v; u; d) (SPDG(v; u; l; d), respectively) holds. The spaceupper bound needed for storing these relations is O(jV j2) where V is the set ofvertices of G.Given a set of numbers fl1; l2; :::; lkg, we use minfl1; l2; :::; lkg to denote theminimum element among the numbers Since the minimum operator (min) isapplied to a bounded set at a time in our algorithms, it can be replaced byexpressions using less-than (<).3 Incremental Algorithm for APSD > 0In this section, for an undirected graph G with each edge having a positivedistance, we give our incremental maintenance algorithms to �nd the shortestdistance between every pair of vertices after single edge insertion and singleedge deletion. The technique for edge insertion is fairly simple and its similarforms have been used previously. The technique for edge deletion is much moreinvolved than that for edge insertion. During the process of edge deletion, weuse one property for undirected graphs (Lemma 2): any shortest path of G�ecan be regenerated through the join of two shortest paths, which do not passthrough edge e, with one edge in G�e. It is because of this property that ouralgorithms belongs to FO(+; <). The algorithms in this section can be used toincrementally maintain the transitive closure of undirected graphs (by settingSPG to be f(x; y; l)j there exists a path between x and y in G and l is theminimum number of edges on such paths g).The algorithms in this section use the following lemma. Intuitively, it impliesthat a shortest path can only be built from (other) shortest paths.Lemma 1. Given an undirected graph G,1. if path p = uw1:::wkv (u = w0, v = wk+1) is a shortest path between u andv then any real subpath q = wi:::wj of p is the shortest path between wi andwj , where 0 � i < j � k + 1.

2. if dist(g) > 0 for each edge g 2 G, a walk between two vertices can never bea shortest if it is not a path.Proof. 1. Otherwise, suppose subpath q1 = wi:::wj is not a shortest path be-tween wi and wj . Let a shortest path between wi and wj be q2 = wiv1:::vhwj .Then dist(q2) < dist(q1) and, for walk q = uw1::wiv1::vh; wj ::wkv, dist(q) <dist(p). That is contradictory to p being a shortest path, and so the resultis proved.2. Suppose walk q = u0u1:::uk is not a path. Then there exist 0 � i < j � k suchthat ui = uj and the distance of subwalk ui:::uj of q is positive. Therefore,q0 = u0::uiuj+1::uk must have a shorter distance than q, and q is not ashortest path. }The converse of Lemma 1(1) does not hold. For example, let G = f(a; b; 1),(b; c; 1), (a; c; 1)g. Then SPG(a; b; 1)^SPG(b; c; 1)^SPG(a; c; 1) holds. The patha b c is not a shortest path in G, but the subpaths a b and b c are shortest paths.3.1 Inserting Edge e to GThe technique for edge insertion is simple. Similar techniques have been usedin many recursive algorithms of [16, 2, 3, 1, 15] and in the �rst-order algorithmsof [7, 14].Theorem 1. Suppose dist(g) > 0 for each edge g of G. When adding a new edgee = (a; b) to G where dist(e) > 0, we can construct a formula of FO(+; <)from SPG and e such that SPG+e � .Proof. Let (x; y; d) � (9d0; d1; d2; d3; d4) SPG(x; a; d1) ^ SPG(b; y; d2) ^SPG(x; b; d3) ^ SPG(a; y; d4) ^ SPG(x; y; d0) ^(d = minfdist(e) + d1 + d2; dist(e) + d3 + d4; d0g):Observe that the use of min is applied to a set of three numbers. So it can bereplaced by formulas with < operators. Therefore, 2 FO(+; <).We need to show SPG+e � . To show that SPG+e ) , let (x; y; d) be anygiven tuple of SPG+e , Two cases arise:1. Edge e is not on the shortest paths between x and y. Then SPG(x; y; d) holdsand so (x; y; d) is true.2. Edge e is on a shortest path between x and y. Let us assume, without loss ofgenerality, the shortest path has the form of x:::w:::ab:::v:::y. By Lemma 1,since path x:::w:::ab:::v:::y is the shortest path in G+ e, paths q1 = x:::w:::aand q2 = b:::v:::y are shortest paths and they clearly do not pass throughedge e. Therefore, d = dist(q1) + dist(q2) + dist(e) and (x; y; d) is true.

To show that ) SPG+e , let (x; y; d) be a tuple such that (x; y; d) istrue. Observe that is selecting the smallest distance d of the shortest pathsfrom x to y that passes through e and the shortest paths from x to y that donot pass through e. This d is clearly the shortest distance from x to y. HenceSPG+e(x; y; d) holds. }Example 1. LetG = f(a; j; 1); (a; e; 52); (b; c; 7); (b; k; 7); (c; d; 2); (d; e; 2); (e; f; 4);(f; g; 6); (g; h; 3); (g; l; 2); (h; i; 8); (h; l; 2); (i; j; 19); (k; l; 6)gas shown in Figure 3.1(1). The shortest paths between vertices are given inFigure 3.1(2). Consider inserting the edge " = (a; b; 2) (dist(") = 2). The shortestpaths of G + " computed by the algorithm are shown in Figure 3.1(3). Forinstance, SPG+"(a; c; 9) holds since 9 = minf2 + 7; 45g, G(a; b; 2), SPG(b; c; 7)and SPG(a; c; 45).

1417 1818

83 11

1213 21 14 186 9

2

16106

10

8 288 18

19 16

14

3 7 132 4 8

2215

7 9 11 15 15 1514

15 23 12 164 10

1217 25 10 14 16

2 6

2

6

7

52

a b

2

463

8

19

1 c

l

(1)

(2) (3)

kd

efghi

j

2

2 7

2

9

9 17 36 14 810

8

46

8 27 811 30

131618

144 8 17 25

4221 40 12

6 12 15 23

7

i j k l

ab

ha b c d e f g

c

1

22

223

7

k

defghij

44

k l

abcd

jc d e f g h i

e

11 13 17 17 17 20 19

fghijk

2

b

411515 23 4215

37

1413

202831 303611

296

1614

a

35

9434543

19 1016Figure 3.1: Shortest distances3.2 Deleting Edge e from GThe main result in the section is for edge deletion.Theorem 2. For any undirected graph G satisfying dist(e) > 0 for each edgee of G, we can construct a formula of FO(+; <) from SPG and e such thatSPG�e � .To prove Theorem 2 and to construct , we need some lemmas, includingthe following key lemma.

Lemma 2. Let dist(g) > 0 for each edge g of G. Suppose there exists a shortestpath p1 = u:::ab:::v from vertex u to vertex v of G which goes through edgee = (a; b) in the order of ab (as shown in Figure 3.2(I)). Let p2 = uw1:::wkv(u = w0 and v = wk+1) be a shortest path between u and v in G� e.a. If a shortest path of G from u to wi (wi is on p2, 1 � i � k+1) goes throughedge e, then it goes through edge e in the order of ab.b. Similarly, if a shortest path of G from wi (wi is on p2, 0 � i � k) to v goesthrough edge e, then it goes through edge e in the order of ab.c. There exists a vertex wi (1 � i � k + 1) such that for subpaths p21 =uw1:::wi�1 and p22 = wi:::v of p2, no shortest path of G among verticesu;w1; :::; wi�1 (and wi; wi+1; :::; v) goes through edge e.iwi-1

d3

w

a b

u v

a b

u v

wi

(I) (II)

p p

p

2

p1

1

2

d d

d1 4

2Figure 3.2: Regenerates shortest pathsProof. Since (a) and (b) are dual, we will prove (a) and (c) only.For (a), we show that the situation of Figure 3.2(II) cannot happen. Otherwise,there exists a shortest path between u and wi (for some 0 < i � k + 1) whichhas the form of u:::ba:::wi (expressed in dashed line).Let us denote the path, shown by the dashed line (the lower solid line, re-spectively), between u and b by pathdash(u; b) (pathsolid(u; b), respectively) anddenote the path, shown by the dashed line, between a and wi by pathdash(a; wi).By the hypotheses and Lemma 1, the shortest paths between a and b havedistance dist(e) andSPG(a; b; dist(e)) ^ SPG(u; a; dist(pathdash(u; b)) + dist(e))^SPG(u; a; dist(pathsolid(u; b))� dist(e)) ^SPG(u; b; dist(pathsolid(u; b))) ^ SPG(u; b; dist(pathdash(u; b))):The formula means that the shortest paths between u and a have a dis-tance of dist(pathdash(u; b)) + dist(e) and of dist(pathsolid(u; b)) � dist(e); theshortest paths between u and b have a distance of dist(pathsolid(u; b)) and ofdist(pathdash(u; b)). Comparing the distance components (the third attribute)of above formula, we havedist(pathdash(u; b)) + dist(e) = dist(pathsolid(u; b))� dist(e)); anddist(pathsolid(u; b)) = dist(pathdash(u; b)):

Therefore dist(e) = 0, contradictory to the hypothesis that dist(f) > 0 for eachedge f of G.For (c), we illustrate the situation with Figure 3.2(I). Let i be the smallestinteger among [1:::k + 1] such that a shortest path between u and wi uses edgee and every shortest path between u and wi�1 does not use edge e. Since noshortest path from u to u uses e and edge e is on a shortest path between u andv, i exists.According to the way that vertex wi is chosen, subpath p21 = uw1:::wi�1 ofp2 is the shortest path between u and wi�1 both in G and G � e, and there isno shortest path of G among vertices u;w1; :::; wi�1 using edge e. By Lemma 1and Lemma 2(a),SPG(u;wi; d3 + d4 + dist(e)) ^ SPG(u; a; d3) ^ SPG(b; wi; d4) (1)holds. We now prove that e does not lie on any shortest paths among verticeswi; :::; wk; v in G. Otherwise, according to Lemma 1 and Lemma 2(b),SPG(wi; v; d1 + d2 + dist(e)) ^ SPG(wi; a; d1) ^ SPG(b; v; d2) (2)holds. From (1) and (2), since a shortest path between two vertices is not longerthan any other paths between the same vertices, we haved3 + d4 + dist(e) � d3 + d1; and d1 + d2 + dist(e) � d4 + d2:It follows that dist(e) � 0, which is contradictory to our positive-distance edgeassumption. This implies that edge e does not lie on any shortest path amongwi; :::; wk; v and therefore, no shortest path among wi; :::; wk; v goes through edgee. }Example 2. We now illustrate the above lemma by considering undirected graphG+ " in Example 1. The shortest path between vertex j (u = j in the Lemma)and vertex d (v = d in the Lemma) is p1 = j a b c d. Path p2 = j i h g f e d isthe shortest path between j and d not going through edge ". In Lemma 2(c), wecan let the chosen vertex be h (wi = h in the Lemma). Therefore, path(j; i) = j iis the shortest path between j and i and path(h; d) = h g f e d is the shortestpath between h and d (no shortest paths among i and j and among h; g; f; e; dgo through edge (a; b)) according to Lemma 2(c).Lemma 2(a) and Lemma 2(b) imply an \ordering" on the vertices of G.They suggest that if one shortest path from an earlier vertex to a later vertexon path p2 goes through edge e in one \direction" then every shortest path fromany earlier vertex to any later vertex on p2 goes through edge e in the same\direction", so long as the shortest path passes through edge e.Given an undirected graph G satisfying dist(g) > 0 for each edge g of Gand an edge e = (a; b) 2 G, the tuples of SPG can be classi�ed into two kinds:S1, the set of tuples (x; y; d) such that no shortest path between x and y in Ggoes through edge e, and S2 = SPG � S1. Lemma 2 implies that each shortestpath of G � e which is not in S1 can be regenerated, through at most two join

operations, by those shortest paths which do not go through edge e in G (i.e.,in S1). In order to give a full description, we introduce some formulas.For edge e 2 G, let �Ge (x; y; d) be a formula stating the fact that there is ashortest path between x and y in G using edge e = (a; b), that is,�Ge (x; y; d) � (9d0; d1; d2; d3; d4) SPG(x; y; d) ^ [SPG(x; a; d1) ^SPG(b; y; d2) ^ (d = d1 + d2 + dist(e)) _ SPG(x; b; d3) ^SPG(a; y; d4) ^ (d = d3 + d4 + dist(e))]:Ge (x; y; d) � SPG(x; y; d) ^ :�Ge (x; y; d):Then Ge (x; y; d) states that the shortest paths between x and y in G havedistance of d but no such a shortest path uses edge e. With the newly de�nedformulas, Lemma 2(c) can be rewritten into the following form:Lemma 2(d): Let dist(g) > 0 for each edge g of G. Suppose there exists ashortest path p1 = u:::ab:::v from vertex u to vertex v of G which goes throughedge e = (a; b) in the order of ab (as shown in Figure 3.2(I)). Let p2 = uw1:::wkv(u = w0 and v = wk+1) be a shortest path in G� e. Then there exists a vertexwi (1 � i � k + 1) such that for subpaths p21 = uw1:::wi�1 and p22 = wi:::v ofp2, Ge (u;wi�1; dist(p21)) ^G�e(wi�1; wi) ^Ge (wi; v; dist(p22)) holds. }Let �Ge (x; y; d) � (9d1; d2)(9w1; w2) Ge (x;w1; d1) ^dG�e(w1; w2) ^Ge (w2; y; d2) ^ (d = d1 + dist(w1; w2) + d2):Lemma 3. Given an undirected graph G satisfying dist(e) > 0 for each edgee 2 G, SPG�e is a subset of �Ge .Proof. Suppose SPG�e(x; y; d) holds and we prove �Ge (x; y; d) is true.Since SPG�e(x; y; d) holds, there exists a shortest path p = xw1:::wky (letx = w0 and y = wk+1) in G � e such that SPG�e(x; y; dist(p)). Two casesarise: (a) In G, none of the shortest paths between x and y uses edge e. ThenGe (x; y; d) is true. Since dG�e(y; y) ^ Ge (y; y; 0) is true, Ge (x; y; d), dG�e(y; y)and Ge (y; y; 0) are all true. Therefore, �Ge (x; y; d) holds. (b) Otherwise. Thereis a shortest path between x and y in G using edge e. From Lemma 2(d), thereexists wi such thatGe (x;wi�1; d1) ^G�e(wi�1; wi) ^Ge (wi; y; d2) ^ (d = d1 + dist(wi�1; wi) + d2)is true. Therefore, �Ge (x; y; d) holds. }Now, Theorem 2 can be easily proved from Lemma 3.Proof of Theorem 2 Let (x; y; d) � �Ge (x; y; d) ^ (8d0) [�Ge (x; y; d0) ! (d �d0)] Clearly, formula is in FO(+; <). From Lemma 3, we know SPG�e � .On the other hand, suppose (x; y; d) holds. By the de�nition of SPG�e , thereexists d0 such that SPG�e(x; y; d0) holds. Since SPG�e � , (x; y; d0) holds. Bythe de�nition of , there is at most one d00 for tuple (x; y) such that (x; y; d00)holds. So d = d0. Thus � SPG�e . }

Example 3. For a simple illustration of the Theorem, let us consider the undi-rected graph G+" of Example 1. Suppose we delete edge " = (a; b). �G+"" (j; d; 12)is true since the shortest path j a b c d (SPG+"(j; d; 12) holds) between j and duses edge (a; b). The shortest path between j and d in G+" � (a; b) (i.e., G) ispath j i h g f e d (SPG(j; d; 42) holds). �G+"" (j; d; 42) is true since G+"" (j; i; 19),G(i; h) and G+"" (h; d; 15) all hold and the distance of edge (i; h) is 8.Lemma 3 reveals why we have such an incremental maintenance result forundirected graphs. It says that the distance of a shortest path in G�e is boundedby the distances of (three) shortest paths in G. A similar result holds for acyclicdigraphs, but not for general digraphs.Without the condition of dist(g) > 0 for each edge g of G, the \make-up"steps, in which we regenerate those new shortest paths, may not be completedthrough a bounded number of join operations.Example 4. Let G be a connected undirected graph with each edge's distancebeing 0. Whenever an edge is deleted, each tuple of SPG will also be deleted byour algorithm, since the shortest path between every two vertices in the graphhas the same distance as that of a walk passing the deleted edge.One interesting implication of above example is that we need to generalisethe notion of \the distance of a path" to \the length of derivation", for theincremental maintenance of undirected graphs with non-negative edge distances.4 Incremental Algorithm for APSD � 0At the end of Section 3, we have shown in Example 4 that the general APSD � 0problem may not be maintained with only relation SPG for edge deletion. In thissection, we extend the maintenance result of APSD > 0 to APSD � 0 and showsuch maintenance can be obtained through keeping SPDG, the extended relationof SPG by adding one more \attribute" to each tuple. We show that SPDG+eand SPDG�e can be maintained incrementally from G and SPDG in FO(+; <).We note that the incremental maintenance algorithm in Section 3 can also beused for the APSD � 0 problem after non-negative edge insertions and positiveedge deletions. This can be proved similarly as those results in Section 3. Ouralgorithms in this section work for all single edge updates.The existence of 0-distance edges in an undirected graph G implies that somewalks (which are not paths) have the same distance as some paths. When eachedge of G has a positive distance, each tuple of SPG corresponds to paths of G.When G has 0-distance edges, a tuple of SPG may correspond to walks of G.Thus, after deleting a 0-distance edge, each 0-distance walk which goes throughthe deleted edge is deleted if we use the algorithm for edge deletion in Section 3.It is this fact that makes the algorithm for edge deletion of Section 3 incorrect for0-distance-edge deletions. To solve this problem, we will maintain SPDG insteadof SPG.The following lemma means that each tuple (x; y; l; d) of SPDG correspondsto a path and each subpath of the path corresponds to a tuple of SPDG.

Lemma 4. Suppose dist(g) � 0 for each edge g in an undirected graph G andp = u0u1:::uk is a walk of G.1. If SPDG(u0; uk; k; dist(p)) holds then p is a path.2. If SPDG(u0; uk; k; dist(p)) holds then for any subpath p0 = uiui+1:::uj (0 �i < j � k) of path p, SPDG(ui; uj ; j � i; dist(p0)) holds.Proof. 1. Suppose walk p = u0u1:::uk is not a path. Then there exist 0 �i < j � k such that ui = uj and the subwalk ui:::uj of p passes at leastone edge. Therefore, q = u0::uiuj+1::uk passes less edges than p does anddist(q) � dist(p). It implies that SPDG(u0; uk; k; dist(p)) cannot be true.2. Otherwise, there exists a subpath q1 = ui:::uj such that SPDG(ui; uj ; j �i; dist(q1)) is not true. Let q2 = uiv1:::vhuj be a path between ui and uj suchthat SPDG(ui; uj ; h+ 1; dist(q2)) holds. Since :SPDG(ui; uj ; j � i; dist(q1))holds, (dist(q2) < dist(q1)) _ (h+ 1 < j � i) holds. Let us consider the walkq = u0u1::uiv1::vhuj ::ukv. Clearly, (dist(q) < dist(p))_ (i+h+k�j+1 < k)holds. This is contradictory to the fact that SPDG(u0; uk; k; dist(p)) holds.Therefore, the result is proved. }We note that the converse of Lemma 4(1) does not hold. For example, letG be the undirected graph of f(a; b; 1); (b; c; 0); (c; d; 0); (b; d; 0); (d; e; 1)g. Thenq = a b c d e is a path (dist(p) = 2). But :SPDG(a; e; 4; 2) ^ SPDG(a; e; 3; 2)holds.4.1 Inserting Edge e to GTheorem 3. Suppose dist(g) � 0 for each edge g of G. When adding a new edgee = (a; b) to G where dist(e) � 0, we can construct a formula ' of FO(+; <)from SPDG, G and e such that SPDG+e � '.Proof. Let ' be de�ned through the following formulas:SPG+e(x; y; d) � (9d0; d1; d2; d3; d4)(9l0; l1; l2; l3; l4) SPDG(x; y; l0; d0) ^SPDG(x; a; l1; d1) ^ SPDG(b; y; l2; d2) ^ SPDG(x; b; l3; d3) ^SPDG(a; y; l4; d4) ^(d = minfdist(e) + d1 + d2; dist(e) + d3 + d4; d0g):�Ge (x; y; l; d) � (9d1; d2; d3; d4)(9l1; l2; l3; l4) SPG+e(x; y; d) ^[SPDG(x; y; l; d) _ SPDG(x; a; l1; d1) ^ SPDG(b; y; l2; d2) ^(d = dist(e) + d1 + d2) ^ (l = l1 + l2 + 1) _ SPDG(x; b; l3; d3) ^SPDG(a; y; l4; d4) ^ (d = dist(e) + d3 + d4) ^ (l = l3 + l4 + 1)]:'(x; y; l; d) � �Ge (x; y; l; d) ^ (8l0)[�Ge (x; y; l0; d)! (l � l0)]:Clearly, ' 2 FO(+; <) since min can be replaced with less-than (<).We need to prove SPDG+e � '. In G + e, let q be a shortest path betweenx and y passing through l-number of edges such that SPDG+e(x; y; l; d) holdswhere d = dist(q). Two cases arise:

1. Edge e is not on path q. Then SPG(x; y; d) ^ SPDG(x; y; l; d) holds. Fromthe way that ' is constructed, SPDG+e(x; y; l; d) ^ '(x; y; l; d) holds.2. Edge e is on path q. Let us assume, without loss of generality, that path qhas the form of x:::w:::ab:::v:::y. Since SPDG+e(x; y; l; d) holds for path q, byLemma 4, for subpaths q1 = x:::w:::a and q2 = b:::v:::y, SPDG(x; a; l1; d1) ^SPDG(b; y; l2; d2) holds where di = dist(qi) and li is the number of edgeson path qi (i = 1; 2). Therefore, d = d1 + d2 + dist(e), l = l1 + l2 + 1 andSPDG+e � �Ge holds. Given a tuple (x; y; l; d) of SPDG+e , we claim thatfor each tuple (x; y; l0; d) of �Ge , l � l0 holds (Otherwise, there is a tuple(x; y; lw; d) of �Ge such that lw < l. Then there is a walk qw in G+e such thatdist(qw) = d and length(qw) = lw. This is contradictory to the de�nition ofSPDG+e). Therefore, SPDG+e � ' from the de�nition of '.On the other hand, suppose '(x; y; l; d) holds. By the de�nition of SPDG+e ,there exist d0 and l0 such that SPDG+e(x; y; l0; d0) holds. Since SPDG+e � ','(x; y; l0; d0) holds. By the de�nition of ', there is at most one d00 and onel00 such that '(x; y; l00; d00) holds. So, d = d0 and l = l0. Thus ' � SPDG+e .}4.2 Deleting Edge e from GThe maintenance result for edge deletion isTheorem 4. For any undirected graph G satisfying dist(e) � 0 for each edge eof G, we can construct a formula ' of FO(+; <) from SPDG and e such thatSPDG�e � .Similarly to the APSD > 0 problem, we need the following lemmas to provethe maintenance result.Lemma 5. Suppose dist(g) � 0 for each edge g of G. In G, let p1 be a shortestpath between vertex u and vertex v which passes through the minimum numberof edges of all such shortest paths (i.e., SPDG(u; v; l; dist(p1)) holds for some l).We assume, without loss of generality, path p1 goes through edge e = (a; b) in theorder of u:::ab:::v as shown in Figure 3.2(I). Let p2 = uw1:::wkv be a shortestpath between u and v (u = w0, v = wk+1) in G � e and SPDG�e(u; v; k +1; dist(p2)) holds.a. If a shortest-path q1 from u to wi (i = 1; :::; k + 1) goes through edge e andpasses through l1-number of edges such that SPDG(u;wi; l1; dist(q1)) holds,then path q1 from u to wi goes through edge e in the order of ab.b. If a shortest-path q2 from wi (i = 0; :::; k) to v goes through edge e andpasses through l2-number of edges such that SPDG(wi; v; l2; dist(q2)) holds,then path q2 from wi to v goes through edge e in the order of ab.c. There exists a vertex wi (1 � i � k + 1) such that for the subpaths p21 =uw1:::wi�1 and p22 = wi:::v of p2,SPDG(u;wi�1; i� 1; dist(p21)) ^ SPDG(wi; v; k + 1� i; dist(p22))

holds and no shortest path among u;w1; :::; wi�1 (wi; :::; wkv, respectively)goes through edge e and passes h-number of edges in G satisfying h � i� 1(h � k + 1� i, respectively).Proof. Since (a) and (b) are dual, we will prove (a) and (c) only.For (a), we show that the situation of Figure 3.2(II) cannot happen. Otherwise,there exists a shortest path q0 (expressed in dashed line) between u and wi forsome 0 < i � k + 1 such that SPDG(u;wi; k1 + k2 + 3; dist(q0)).Let us denote the path, shown by the dashed line (solid line, respectively),between vertex u and vertex b by pathdash(u; b) (pathsolid(u; b), respectively) anddenote the path, shown by the dashed line, between a and wi by pathdash(a; wi).By the hypotheses and Lemma 4, the shortest paths from a to b in G havedistance dist(e) andSPDG(a; b; 1; dist(e)) ^ SPDG(u; a; k1 + 2; dist(pathdash(u; b)) + dist(e))^SPDG(u; a; h3; dist(pathsolid(u; b))� dist(e))^SPDG(u; b; h3 + 1; dist(pathsolid(u; b)))^SPDG(u; b; k1 + 1; dist(pathdash(u; b)))holds. The formula means that the minimum number of edges on shortest pathsbetween u and a is k1 + 2 and h3; the minimum number of edges on shortestpaths between u and b is k1 + 1 and h3 + 1. Comparing the third attribute ofeach component in the formula, we have an unsatis�able condition (h3 + 1 =k1 + 1) ^ (k1 + 2 = h3) being true. Therefore, we proved (a).For (c), we illustrate the situation with Figure 3.2(I). Let i be the smallestinteger from [1:::k+1] (i) there is a shortest path p0 from u to wi going throughedge e such that SPDG(u;wi; length(p0); dist(p0)) holds and (ii) any path puwi�1from u to wi�1 satisfying SPDG(u;wi�1; length(puwi�1); dist(puwi�1)) does notgo through edge e. Since SPDG(u; u; 0; 0)^SPDG(u; v; l; dist(p1)) holds, i exists.Let us consider subpath p21 = uw1:::wi�1 of p2. Since SPDG�e(u; v; k +1; dist(p2)) holds, from Lemma 4, SPDG�e(u;wi�1; i � 1; dist(p21)) holds. Fromthe way that vertex wi is chosen and the de�nition of SPDG, SPDG(u;wi�1; i�1; dist(p21)) holds. Therefore, subpath p21 satis�es (c).Let q3 (q4, respectively) be the subpath from u to a (from b to wi, respec-tively) of p0. Denote dist(qh) (length(qh), respectively) by dh (lh, respectively)for h = 3; 4. According to Lemma 5(a),SPDG(u; a; l3; d3) ^ SPDG(b; wi; l4; d4)^ (3)SPDG(u;wi; l3 + l4 + 1; d3 + d4 + dist(e))holds. We now prove that there is no path p00 of G using edge e among verticeswi; :::; wk; v in G such that SPDG(wi; v; length(p00); dist(p00)) holds. Otherwise,Let q1 (q2, respectively) be the subpath from wi to a (from b to v, respectively) ofp00. Denote dist(qh) (length(qh), respectively) by dh (lh, respectively) for h = 1; 2.By Lemma 4 and Lemma 5(b),SPDG(wi; v; l1 + l2 + 1; d1 + d2 + dist(e))^ (4)SPDG(wi; a; l1; d1) ^ SPDG(b; v; l2; d2)

holds. From (4) and (5) and since a shortest path between two vertices is notlonger than any path between the same vertices, we haved3 + d4 + dist(e) � d3 + d1; and d1 + d2 + dist(e) � d4 + d2:The formulas imply dist(e) = 0 and d1 = d4. Consequently, from the hypothesesand Lemma 4, SPDG(a; wi; l4 + 1; d4) ^ SPDG(wi; a; l1; d4)^SPDG(b; wi; l4; d4) ^ SPDG(wi; b; l1 + 1; d4)holds. Form the above formula and the de�nition of SPDG, we havel4 + 1 = l1; and l4 = l1 + 1:The above formulas imply 1 = 0. This is contradiction. Thus we proved theresult. }For edge e = (a; b) of G, let �Ge (x; y; l; d) be a formula expressing those tuplesof SPDG using edge e, that is,�Ge (x; y; l; d) � (9d1; d2; d3; d4)(9l1; l2; l3; l4) SPDG(x; y; l; d) ^[SPDG(x; a; l1; d1) ^ SPDG(b; y; l2; d2) ^ (l = l1 + l2 + 1) ^(d = d1 + d2 + dist(e)) _ SPDG(x; b; l3; d3) ^ SPDG(a; y; l4; d4) ^(l = l3 + l4 + 1) ^ (d = d3 + d4 + dist(e))]:Ge (x; y; l; d) � SPDG(x; y; l; d) ^ :�Ge (x; y; l; d):Thus Ge (x; y; l; d) states that the shortest paths between x and y which havedistance d and length l do not use edge e. With the newly de�ned formulas,Lemma 5(c) can be rewritten into the following form:Lemma 5(d): Suppose dist(g) � 0 for each edge g ofG. InG, let p1 be a shortestpath between vertex u and vertex v which passes through the minimum numberof edges of all such shortest paths (i.e., SPDG(u; v; l; dist(p1)) holds for some l).We assume, without loss of generality, path p1 goes through edge e = (a; b) in theorder of u:::ab:::v as shown in Figure 3.2(I). Let p2 = uw1:::wkv be a shortest pathbetween u and v (u = w0, v = wk+1) in G� e and SPDG�e(u; v; k + 1; dist(p2))holds. Then there exists a vertex wi (1 � i � k + 1) such that for subpathsp21 = uw1:::wi�1 and p22 = wi:::v of p2, Ge (u;wi�1; length(p21); dist(p21)) ^G�e(wi�1; wi) ^Ge (wi; v; length(p22); dist(p22)) holds. }Let �Ge (x; y; l; d) be(9d1; d2)(9l1; l2)(9w1; w2) Ge (x;w1; l1; d1) ^dG�e(w1; w2)^Ge (w2; y; l2; d2) ^ [(l = l1 + l2 + 1) ^ (w1 6= w2) _ (l = l1 + l2) ^(w1 = w2)] ^ (d = d1 + dist(w1; w2) + d2):The following is the main lemma of the section.

Lemma 6. Given an undirected graph G satisfying dist(e) � 0 for each edgee 2 G, SPDG�e � �Ge .Proof. Suppose SPDG�e(x; y; l; d) holds. We prove �Ge (x; y; l; d) is true.Since SPDG�e(x; y; l; d) holds, there exists a shortest path p = xw1:::wl�1y(let x = w0 and y = wl) in G � e such that SPDG�e(x; y; l; dist(p)). Twocases arise: (a) None of the shortest paths between x and y use edge e in G.Then Ge (x; y; l; d) is true. Since dG�e(y; y)^Ge (y; y; 0; 0) is true, Ge (x; y; l; d),dG�e(y; y) and Ge (y; y; 0) are all true. Therefore, �Ge (x; y; l; d) holds. (b) Other-wise. Then there is a shortest path between x and y in G using edge e. FromLemma 2(d), there exists wi such that(9d1; d2)(9l1; l2) Ge (x;wi�1; l1; d1) ^dG�e(wi�1; wi) ^Ge (wi; y; l2; d2)^(l = l1 + l2 + 1) ^ (d = d1 + dist(wi�1; wi) + d2):is true. Therefore, �Ge (x; y; l; d) holds. }Proof of Theorem 2 LetMPGe (x; y; l; d) � �Ge (x; y; l; d) ^ (8d0)(8l0) [�Ge (x; y; l0; d0)! ((d � d0)]; and'(x; y; l; d) �MPGe (x; y; l; d) ^ (8l0) [MPGe (x; y; l0; d)! (l � l0)]:Clearly, ' is in FO(+; <). We need to prove SPDG�e � '.1. Suppose SPDG�e(x; y; l; d) holds. From Lemma 6, we know SPDG�e � �Ge .By the de�nition of SPDG�e , SPDG�e � MPGe holds and SPDG�e � 'holds.2. Suppose '(x; y; l; d) holds. By the de�nition of SPDG�e , there exist d0 and l0such that SPDG+e(x; y; l0; d0) holds. Since SPDG�e � ', '(x; y; l0; d0) holds.Then there is at most one d00 and one l00 such that '(x; y; l00; d00) holds fromthe de�nition of '. So, d = d0 and l = l0. Thus ' � SPDG�e . }5 A Limited Reduction between SPG and SPDGThe algorithm for APSD > 0 in Section 3 does not need to maintain anyauxiliary information during the evaluation while the algorithm for APSD � 0in Section 4 does need auxiliary relation. The algorithm for the APSD � 0problem can be considered as using the algorithm for APSD > 0 twice, once fordistance and once for length. in a nested way.In many practical applications, any modi�cation on the edges of undirectedgraph G must have some physical limitations, e.g., the amount of informationpassed through a cable is bounded by the physical property of the cable and thelength of cables used is �nitely bounded. To model such situations, we assume,

for each edge g of G = (V;E), dist(g) is a non-negative integer and n is theupper bound of jV j. Under such assumption, the APSD � 0 problem can besolved by using the method for APSD > 0 through rede�ning the dist(g) withDIST(g) for each edge g of G, where DIST(g) = dist(g) � n + 1. In this way,for a given undirected graph G, we actually construct a new graph GL, which isthe same as G except that distance is de�ned by \DIST" instead of \dist". Theincremental maintenance of the APSD � 0 problem for graph G with relationSPDG is transformed to the maintenance of the APSD > 0 problem for graphGL with relation SPGL .The correctness of this transformation is based on the following two facts:(i) For each tuple (x; y; l; d) of SPDG there is only one tuple (x; y; dL) of SPGLwhere dL = d � n + l and, for each tuple (x; y; dL) of SPGL there is only onetuple (x; y; d; l) of SPDG where d = (dL div n) and l = (dL mod n) ; (ii) Forany two paths p1 and p2 between vertex x and vertex y, if dist(p1) < dist(p2)then DIST(p1) < DIST(p2) holds and if DIST(p1) < DIST(p2) then dist(p1) �dist(p2) holds. Since DIST(p1) = dist(p1)�n+l1 and DIST(p2) = dist(p2)�n+l2,DIST(p2)�DIST(p1) = (dist(p2)�dist(p1))�n+(l2�l1). Therefore, if dist(p2) >dist(p1) holds, then DIST(p2)�DIST(p1) � n� (n� 1) > 0 holds. Similarly, wecould prove that dist(p1) � dist(p2) holds if DIST(p1) < DIST(p2).Let G = (V;E) be an undirected graph with restrictions such that dist(g) isan integer for each edge g of G and n is the upper bound of jV j. The key pointof the algorithm is that l < n holds for each tuple (x; y; l; d) of SPDG.6 Concluding RemarksWe have given FO(+; <) algorithms for the incremental maintenance of theAPSD > 0 problem and the APSD � 0 problem. Our algorithms have a lowparallel complexity and make additional optimizations possible (e.g., the opti-mization techniques in relational database). These extend earlier results on themaintenance of transitive closure of undirected graphs and the results in [8].For example, our algorithms for the APSD � 0 problem can be used to answerqueries such as \list the minimum number of cities on a shortest path".Our results can be applied to the following problems: (i) Although all themaintenance results in the paper are written for set semantics, they can beeasily extended to bag semantics (multiset) by storing the number of alternativeshortest paths of a tuple along with the tuple itself. For example, consideringthe APSD > 0 problem, we de�ne SP cG to be f(x; y; d; c)j d is the distanceof the shortest path between x and y; c is the number of alternative shortestpaths between x and y g. SP cG(x; y; d; c) is true if and only if there exists calternative shortest paths between x and y in G which have distance of d. Themaintenance algorithms are similar to that of SPG. (ii) Our algorithms can beused to maintain the shortest paths themselves. Refer to [13] for more details.Acknowledgements:We would like to thank Kevin Glynn for his helpful com-ments. We are also grateful to the anonymous referees for their very helpful

remarks, including spotting an error in an earlier version of the paper. Part ofDong's work was done while visiting Simon Fraser University and George MasonUniversity during his study leave.References1. G. Ausiello, G. F. Italiano, A. M. Spaccamela, and U. Nanni. On-line computa-tion of minimal and maximal length path. Theor.Comput.Sci., Elsevier SciencePublisher, 95, 2:245{261, 1992.2. J. A. Blakeley, P.-A. Larson, and F. W. Tompa. E�ciently updating materializedviews. In Proc. ACM SIGMOD Int. Conf. on Management of Data, pages 61{71,1986.3. A. L. Buchsbaum, P. C. Kanellakis, and J. S. Vitter. A data structure for arc inser-tion and regular path �nding. In Proc. ACM-SIAM Symp. on Discrete Algorithms,1990.4. Hristo N. Djidjev, Grammati E. Pantziou, and Christos D. Zaroliagis. On-line anddynamic algorithms for shortest path problems. In STACS: Annual Symposium onTheoretical Aspects of Computer Science, 1995.5. G. Dong and C. Pang. Maintaining transitive closure in �rst-order after node-setand edge-set deletions. Information Processing Letters, 62(3):193{199, 1997.6. G. Dong and J. Su. Space bounded FOIES. In Proc. of the ACM Symposium onPrinciples of Database Systems, pages 139{150, May 1995.7. G. Dong and R. Topor. Incremental evaluation of datalog queries. In Proc. Int'lConference on Database Theory, pages 282{296, Berlin, Germany, October 1992.8. Guozhu Dong and Ramamohanarao Kotagiri. Incrementally evaluating constrainedtransitive closure by conjunctive querie. In International Conference on Deductiveand Object-Oriented Databases, 1997.9. S. Even and H. Gazit. Updating distances in dynamic graphs. Methods of Opera-tions Research, 49:371{387, 1985.10. E. Feuerstein and A. Marchetti-Spaccamela. Dynamic algorithms for shortest pathsin planar graphs. Theoretical Computer Science, 116(2):359{371, 1993.11. S. Grumbach and J. Su. First-order de�nability over constraint databases. InProceedings of Conference on Constraint Programming, 1995.12. Philip N. Klein, Satish Rao, Monika H. Rauch, and S. Subramanian. Fastershortest-path algorithms for planar graphs. In Proc. 26th Symp. Theory of Com-puting, pages 27{37. Assoc. for Computing Machinery, 1994.13. Chaoyi Pang. Incremental Maintenance Reachability of Graph in First-order andIts extension. PhD thesis, The University of Melbourne, 1999.14. Sushant Patnaik and Neil Immerman. Dyn-FO: A parallel dynamic complexityclass. In Proc. ACM Symp. on Principles of Database Systems, pages 210{221,1994.15. G. Ramalingam. Bounded Incremental Computation. LNCS 1089, 1996.16. O. Shmueli and A. Itai. Maintenance of views. In Sigmod Record, volume 14(2),pages 240{255, 1984.17. P.M.N. Spira and A. Pan. On �nding and updating spanning trees and shortestpaths. SIAM Journal on Computing, 3(4):375{380, September 1975.