partially dynamic maintenance of minimum weight hyperpaths

20
Journal of Discrete Algorithms 3 (2005) 27–46 www.elsevier.com/locate/jda Partially dynamic maintenance of minimum weight hyperpaths Giorgio Ausiello a,, Paolo Giulio Franciosa b , Daniele Frigioni c a Dipartimento di Informatica e Sistemistica, Università di Roma “La Sapienza”, Via Salaria 113, I-00198 Roma, Italy b Dipartimento di Statistica, Probabilità e Statistiche Applicate, Università di Roma “La Sapienza”, Piazzale Aldo Moro 5, I-00185 Roma, Italy c Dipartimento di Ingegneria Elettrica, Università dell’Aquila, Monteluco di Roio I-67040 L’Aquila, Italy Available online 27 January 2004 Abstract We address the problem of dynamically maintaining minimum weight hyperpaths in a directed hypergraph in a decremental setting. For such a problem, we provide a new efficient algorithm that works for a wide class of hyperpath weight measures. This algorithm explicitly updates minimum weight hyperpaths in O(L · C + max{n, Csize(H)) worst case time under a sequence of L hyperarc weight increments and hyperarc deletions, where C is the maximum weight of minimum hyperpaths in H and size(H) is the size of the representation of the hypergraph. Hyperpath weight measures are only required to belong to the class of strict weakly superior functions. 2004 Elsevier B.V. All rights reserved. Keywords: Directed hypergraph; Minimum weight hyperpath; Dynamic algorithm 1. Introduction Hypergraph is a common name for various combinatorial structures that generalize graphs. Beside the most known undirected hypergraphs, or simply hypergraphs (see [13]), a relevant role is played by directed hypergraphs (see [18]), a generalization of directed Partially supported by the Future and Emerging Technologies programme of the European Union under contract number IST-1999-14186 (ALCOM-FT). * Corresponding author. E-mail addresses: [email protected] (G. Ausiello), [email protected] (P.G. Franciosa), [email protected] (D. Frigioni). 1570-8667/$ – see front matter 2004 Elsevier B.V. All rights reserved. doi:10.1016/j.jda.2003.12.005

Upload: independent

Post on 06-Mar-2023

0 views

Category:

Documents


0 download

TRANSCRIPT

a

ectedm thatimum

hsres are

ralize

d

under

sa),

Journal of Discrete Algorithms 3 (2005) 27–46

www.elsevier.com/locate/jd

Partially dynamic maintenanceof minimum weight hyperpaths✩

Giorgio Ausielloa,∗, Paolo Giulio Franciosab, Daniele Frigionic

a Dipartimento di Informatica e Sistemistica, Università di Roma “La Sapienza”, Via Salaria 113,I-00198 Roma, Italy

b Dipartimento di Statistica, Probabilità e Statistiche Applicate, Università di Roma “La Sapienza”,Piazzale Aldo Moro 5, I-00185 Roma, Italy

c Dipartimento di Ingegneria Elettrica, Università dell’Aquila, Monteluco di Roio I-67040 L’Aquila, Italy

Available online 27 January 2004

Abstract

We address the problem of dynamically maintaining minimum weight hyperpaths in a dirhypergraph in a decremental setting. For such a problem, we provide a new efficient algorithworks for a wide class of hyperpath weight measures. This algorithm explicitly updates minweight hyperpaths in O(L ·C +max{n,C} ·size(H)) worst case time under a sequence ofL hyperarcweight increments and hyperarc deletions, whereC is the maximum weight of minimum hyperpatin H and size(H) is the size of the representation of the hypergraph. Hyperpath weight measuonly required to belong to the class ofstrict weakly superior functions. 2004 Elsevier B.V. All rights reserved.

Keywords:Directed hypergraph; Minimum weight hyperpath; Dynamic algorithm

1. Introduction

Hypergraph is a common name for various combinatorial structures that genegraphs. Beside the most known undirected hypergraphs, or simplyhypergraphs(see[13]),a relevant role is played bydirected hypergraphs(see[18]), a generalization of directe

✩ Partially supported by the Future and Emerging Technologies programme of the European Unioncontract number IST-1999-14186 (ALCOM-FT).

* Corresponding author.E-mail addresses:[email protected] (G. Ausiello), [email protected] (P.G. Francio

[email protected] (D. Frigioni).

1570-8667/$ – see front matter 2004 Elsevier B.V. All rights reserved.

doi:10.1016/j.jda.2003.12.005

28 G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46

tics for

t

-

rcs.the

d 9

idelyepre--

ng at-

et

to finde min-s. Forond toplexitym-

endingimumis the

Fig. 1. A directed hypergraph.

graphs, which find applications in several areas of computer science and mathemarepresenting implicative structures. In a directed hypergraph we are given a setN of n

nodes and a setA of m hyperarcs. Each hyperarc is a pair〈T ,h〉, whereT is a subseof N , called thetail of the hyperarc, andh is a single node inN , called theheadof thehyperarc. The most obvious interpretation of a hyperarc〈T ,h〉 is that the information associated toh functionally depends on the information associated to nodes inT . Thesizeof a hypergraph, denoted by size(H), is the sum of the sizes of the tails of the hyperaClearly,m � size(H) � m · n, where these bounds are tight. It is worth noting that, incase of hypergraphs,m can be�(2n). In Fig. 1we show a hypergraph with 8 nodes anhyperarcs; hyperarch5 has tail{a, b} and heade, while the size of the hypergraph is 13.

Directed hypergraphs and other strictly related combinatorial structures are wused in computer science. Notably, they are used in artificial intelligence for rsenting problem solving relationships (And-Or graphs[28] and recursive label-node hypergraphs[14]), in database theory for representing functional dependencies amotributes (FD-graphs[5] and connections in acyclic hypergraphs[25,33]), in deductivedatabases[19], in fuzzy logic, for determining the reliability of facts[8], in propositionallogic, for satisfiability check (namely in the case of Horn formulæ[9,17,29]), in formallanguages (weighted context free grammars[22]), in the theory of concurrency (Petri npaths[34]), in model checking (dependency graphs[24] and boolean graphs[3]), in diag-nostics[2]. More applications can be found in[1,18,30].

Any time a structure is represented by means of a hypergraph, it may be relevanthyperpaths that connect nodes or sets of nodes, or “minimum” hyperpaths, where thimality is defined on the basis of a weight function that assigns weights to hyperpathexample, if the hypergraph is used to represent a Horn formula, hyperpaths correspproofs and the weight of a hyperpath can be related to different measures of the comof a proof (see[4,9] for more details). Thick hyperarcs inFig. 1represent a hyperpath frosourceS = {a, b} to nodet , consisting of hyperarcs〈h5, h6, h9〉. Further applications of hyperpaths and minimum hyperpaths to different contexts can be found in[1,8,15,20,23,26].

There are various ways in which a weight can be attached to a hyperpath. Depon the measure used to assign a weight to a hyperpath the problem of finding minweight hyperpaths can be polynomially solvable or NP-hard. One possible measurecostof a hyperpath, which is the sum of the weights of its hyperarcs: in[11] it has been

G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46 29

shown that the problem of finding minimumcosthyperpaths in a directed hypergraph isusual

e casee

istance

hm to

s thateriva-

s the

ighthangeshyper-t of the

hy-letionsental),ns arees inHorn

con-

expla-in the

nance

al case,ofns,

nder aofum

NP-hard. If the tail of each hyperarc is a single node, then the cost reduces to theconcept of distance in a directed graph. Other generalizations of the distance to thof hypergraphs are therank and thegap [21], for which the minimization problem can bsolved in polynomial time. Weight measures are discussed inSection 2.

Observe that cost, rank and gap are all generalizations of the standard notion of din graphs, which can be computed in polynomial time.

Several attempts have been made in the literature to extend Dijkstra’s algoritcompute minimum weight hyperpaths. For example, in[22] Knuth defines thegrammarproblemas a generalization of the single source shortest path problem, and showDijkstra’s algorithm can be adapted to solve the grammar problem when the costs of dtions are expressed bysuperior functions. A functiong(x1, x2, . . . , xk) is superior if it ismonotone nondecreasing in each variable andg(x1, x2, . . . , xk) � max{x1, x2, . . . , xk}; ifthe inequality is strict, theng is strict superior. Ramalingam and Reps in[31] identifya larger class of functions that are suitable for a Dijkstra-like visit strategy, that iclass ofweakly superiorfunctions. A functiong(x1, x2, . . . , xk) is weakly superior if it ismonotone nondecreasing in each variable and for eachi ∈ [1, k], if g(x1, x2, . . . , xk) < xi ,theng(x1, . . . , xi, . . . , xk) = g(x1, . . . ,∞, . . . , xk). If the inequality is not strict, theng isstrict weakly superior.

In this paper, we consider the problem of dynamically maintaining minimum wehyperpaths in a directed hypergraph subject to modifications as hyperarc weight cand hyperarc insertions or deletions. In this setting we do not want to recomputepaths from scratch after each change, but we want to take advantage of the parprevious solution that is still valid. A common classification of dynamic problems inpergraphs is among fully-dynamic ones, where weight changes, insertions and deof hyperarcs can be intermixed, and partially-dynamic ones (incremental or decremwhere only weight decrements and insertions or only weight increments and deletioallowed, respectively. The problem of maintaining minimum weight hyperpaths arisseveral application domains as, for example, in the minimum model maintenance informulæ[7–9,31]. In particular, the decremental problem finds applications in thetext of assumption-based truth maintenance systems[15,23], where maintaining minimumhyperpaths under deletions of hyperarcs corresponds to maintaining a set of “small”nations of all observations under the elimination of either a hypothesis or a clausebackground theory.

The first hypergraph problem stated in a dynamic framework has been the mainteof the transitive closure of a directed hypergraph under hyperarc insertions[10]. Minimumweight traversal problems have been studied by various authors. For the incrementan algorithm is presented in[9], that maintains satisfiability and the minimum modela Horn formulaF in O(n · Length(F)) total time over a sequence of clause insertiowhere Length(F) is the sum of the number of literals in the clauses ofF . This algorithm isextended in[8] to the case of Horn formulæ with uncertainty. Algorithms are given in[21]for the incremental maintenance of minimum rank and minimum gap hyperpaths usequence of hyperarc insertions in overall O(n · size(H)) time, under the assumptionunit hyperarc weights. In[7] a decremental algorithm is proposed to maintain minim

30 G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46

rank hyperpaths under a sequence of hyperarc deletions and weight increments in overall

tions.n,

yperarctheerarcsighte fully

withacklingy supe-imple

aging

erval

min-rc

e-uperior

perarce is thearting

s

pathdate isby the

algo-yo cut

verall

O(W · n · size(H)) worst case time in the case of integer hyperarc weights in[1,W ].The fully dynamic version of the problem has been considered in[31]. The authors

propose a Dijkstra-like procedure, applicable to strict weakly superior weight funcThe proposed algorithm takes O(‖δ‖· (log‖δ‖+M)) worst case time per update operatiowhere each operation may consist of several insertions/deletions of hyperarcs and hweight changes. Parameter‖δ‖ represents the number of nodes for which the weight ofminimum weight hyperarc changes due to the update, plus the total number of hypincident to these nodes, whileM is the time needed to recompute the value of a wefunction. In the same paper, Ramalingam and Reps also provide an algorithm for thdynamic problem on strict superior weight functions, that requires O(‖δ‖ · log‖δ‖) worstcase time per update operation.

In this paper, we first show a simple extension of known strategies for dealingthe incremental case, and then propose and analyze in detail a new technique for tthe decremental case. In both cases, the proposed algorithms apply to strict weaklrior weight functions, provided that the function value associated to a hyperarc is senough to be efficiently updated, as for example the rank.

For the incremental case, we describe an extension of Dijkstra’s algorithm for manan arbitrary sequence ofL hyperarc insertions and weight decrements in overall O(L ·C +C · size(H)) worst case time, if minimum weight hyperpaths assume weights in an intof integers[1,C]. When applied to rank, we obtain the same time bounds of thesort-by-structurestrategy given in[12].

Concerning the decremental problem, we propose a new algorithm for maintainingimum weight hyperpaths under a sequence ofL hyperarc weight increments and hyperadeletions, requiring O(L · C + max{n,C} · size(H)) worst case time for the whole squence. The algorithm assumes that each hyperarc is associated a strict weakly sweight function, and minimum weight hyperpaths assume integer weight in[1,C].

Our decremental solution is based on a novel technique that, after the update of hy〈X,y〉, explores the nodes whose weight and/or port changes (here, the port of a nodincoming hyperarc to that node in the minimum weight hyperpath from the source), stfrom nodey and proceeding one level at a time. Here, we say that a node is at leveli if itsweight is equal toi. For eachi, the algorithm builds thenewlevel i by selecting the nodebelonging to theold level i whose port changes, and nodes coming fromold levelsj < i

whose weight increases toi. On the contrary, classical approaches for solving shortestproblems usually work in two phases: first the whole set of nodes affected by the upselected, and then some Dijkstra-like algorithm is applied to the subgraph inducedselected nodes.

The performance of our algorithm must be compared with the performance of therithms proposed by Ramalingam and Reps[31]. Adapting their algorithm for strict weaklsuperior weight functions to deal with integer weight values, it could be possible tout the log‖δ‖ factor, but the time required to handle a single update is O(n · m). In fact,termM depends on the size of hyperarc tails, and can be�(n), while ‖δ‖ can be�(m).If C = O(n), then our algorithm manages any sequence of hyperarc deletions in oO(n · (L + size(H))). If the length of the sequence is�(m), our result improves[31] by afactor(m2/size(H)) on the whole sequence. Since size(H) is O(n ·m), the improvement is

G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46 31

by a factor(m/n). Note that, the longer is the sequence, the better our algorithm performs

r-esented.

n forespectwt in-

r

t.

nce

,nd 2

e

with respect to[31]; in caseL = �(size(H)), the improvement is by a factorm.The paper is organized as follows. InSection 2the basic definitions concerning hype

graphs and hyperpaths are given and various hyperpath weight measures are prSection 3is devoted to a discussion of a variety of hyperpath weight measures. InSec-tion 4 we tackle the dynamic problem. Here, we first propose an incremental solutiothe maintenance of minimum weight hyperpaths by discussing the differences with rto the previous solutions known in the literature (Section 4.1), and then we present a neefficient algorithm for maintaining minimum weight hyperpaths under hyperarc weighcrements (Section 4.2) and hyperarc deletions (Section 4.3). In the last section we drawsome conclusions and suggest future research directions.

2. Hypergraphs and hyperpaths

The following definitions concerning directed hypergraphs are from[6] and[12], andare consistent with the more general definitions given in[18].

A directed hypergraphH (seeFig. 1 for an example) is a pair〈N,A〉, whereN is anon empty set ofn nodesandA is a set ofm hyperarcs; ahyperarce is an ordered pai〈T ,h〉, with T ⊆ N , T �= ∅, andh ∈ N \ T ; T and h are called thetail and theheadof e, and are denoted by tail(e) and head(e), respectively. Theforward starof v ∈ N isthe set fstar(v) = {e ∈ A: v ∈ tail(e)}, while thebackward starof v is the set bstar(v) ={e ∈ A: v = head(e)}. With reference toFig. 1, the forward star of nodeb is {h5, h6},and the backward star of nodef is {h6, h7, h8}. Thesizeof a hypergraphH is defined assize(H) = ∑

e∈A | tail(e)|.Given a hypergraphH, a subhypergraphof H is a hypergraphH′ = 〈N ′,A′〉 with

N ′ ⊆ N andA′ ⊆ A. A subhypergraph isproper if at least one of the inclusions is stricA hyperpathin H from a set of nodesS ⊂ N , with S �= ∅, called source, to a targetnode t ∈ N is a subhypergraphΠS,t = 〈NΠS,t

,AΠS,t〉 of H having the following prop-

erty: if t ∈ S, thenAΠS,t= ∅, otherwise itsk � 1 hyperarcs can be ordered in a seque

〈e1, . . . , ek〉 such that:

1. ∀ei ∈ AΠS,t, tail(ei) ⊆ S ∪ {head(e1), . . . ,head(ei−1)};

2. t = head(ek);3. No proper subhypergraph ofΠS,t is a hyperpath fromS to t in H.

Note that, with reference toFig. 1, subhypergraph{h5, h6, h8, h9} is not a hyperpathsinceh8 could be removed from the subhypergraph still satisfying conditions 1 aabove.

The above definition of hyperpath is consistent with the notion offolded hyperpathgiven in [12], and generalizes the notion of simple path in a directed graph. A nodt issaid to bereachablein H from sourceS if there exists a hyperpathΠS,t in H. Theportof a nodev on ΠS,t , denoted by port(v), is the hyperarc inAΠS,t

havingv as head; it isunique by condition3 above.

32 G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46

The most intuitive and classical measure of the weight of a hyperpath is itscost, defined

in this

s,a

t;

ight of

as the sum of the weights of its hyperarcs (see, for example,[11]). A different approachleads to defining the weight of a hyperpath in an inductive manner. First attemptsdirection can be found in[27] and in[11]. This approach has been formalized in[12] inthe following terms.

Definition 2.1. A functional hypergraphHF = 〈N,A;F 〉 is a directed hypergraphH =〈N,A〉 in which each hyperarce = 〈X,y〉 ∈ A is associated to a tripleFe = (we,ψe, fe),where:

• we is a real value;• ψe is a function from|X|-tuples of reals to reals;• fe is a function from pairs of reals to reals.

Let ΠS,t be a hyperpath fromS to t , and let〈Z, t〉 be the last hyperarc inΠS,t (i.e., theport of t), whereZ = {z1, z2, . . . , zk}: then1 ΠS,t = ΠS,z1 ∪ΠS,z2 ∪ · · · ∪ΠS,zk

∪ {〈Z, t〉},whereΠS,zi

is the subhyperpath ofΠS,t going fromS to zi , 1� i � k. The weight ofΠS,t

depends onw〈Z,t〉, that gives theweightof hyperarc〈Z, t〉, and onψ〈Z,t〉, that takes intoaccount the weights of all hyperpathsΠS,zi

. Functionf〈Z,t〉 combines these two weightgiving the weight of hyperpathΠS,t . Sincefe andψe together determine the role ofhyperarce in the weight of a hyperpath containinge, we will often combine them in asingle functionge(we, x1, x2, . . . , xk) = fe(we,ψe(x1, x2, . . . , xk)).

Definition 2.2. Given a functional directed hypergraphHF = 〈N,A;F 〉, a weight mea-sureµ associates a real weight to a hyperpathΠS,t as follows:

• if ΠS,t has no hyperarcs (i.e.,t ∈ S), thenµ(ΠS,t ) = µ0, whereµ0 is a proper constan• if ΠS,t = ΠS,z1 ∪ ΠS,z2 ∪ · · · ∪ ΠS,zk

∪ {〈Z, t〉}, whereZ = {z1, z2, . . . , zk}, thenµ(ΠS,t ) = g〈Z,t〉(w〈Z,t〉,µ(ΠS,z1),µ(ΠS,z2), . . . ,µ(ΠS,zk

)).

Several weight measures have been introduced in the literature to define the wea hyperpath in a functional directed hypergraph, by considering, given a hyperarce suchthat tail(e) = {x1, x2, . . . , xk}, different choices for functionsψe andfe:

rank: fe(x, y) = x + y, ψe(x1, x2, . . . , xk) = max1�i�k{xi}, andµ0 = 0;gap: fe(x, y) = x + y, ψe(x1, x2, . . . , xk) = min1�i�k{xi}, andµ0 = 0;threshold: fe(x, y) = max{x, y}, ψe(x1, x2, . . . , xk) = max1�i�k{xi}, andµ0 = 0;bottleneck: fe(x, y) = min{x, y}, ψe(x1, x2, . . . , xk) = min1�i�k{xi}, andµ0 = +∞;traversal cost: fe(x, y) = x+y, ψe(x1, x2, . . . , xk) = ∑

1�i�k{xi}, whenwe > 0 for eache ∈ A, andµ0 = 0;

1 By a little abuse of notation, given two hypergraphsH1 = 〈N1,A1〉 andH2 = 〈N2,A2〉 we denote thehypergraph〈N1 ∪ N2,A1 ∪ A2〉 by H1 ∪H2.

G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46 33

For example, if we assume that all hyperarcs of the hypergraph inFig. 1 but h5 haveand

ifferent

-ample,

d to aath the

rd.ssiblel time.e aref the

ionals

refunc-f thelasses

duced

unit weight, while hyperarch5 has weight 2, then the thick hyperpath has rank 3, gap 2traversal cost 4.

Some of the weight measures listed above have been used by other authors with dnames. For example, in[17,30], therank is calleddistance, and thetraversal costis calledvalue.

Note that, the notion ofcostdiffers from that oftraversal cost. In fact, in the computation of traversal cost, the weight of a hyperarc may be considered many times. For exwith reference toFig. 1, consider hyperpathπ = 〈h1, h2, h5, h6, h9〉 from s to t . Assum-ing unit hyperarc weights, thecostof π is 5, while itstraversal costis 6 (hyperarch2 ispaid twice: once for reachingb in the tail ofh5 and once for reachingb in the tail ofh6).Actually, this is the reason why thecostcannot be defined inductively as inDefinition 2.2.

3. Minimum weight traversal problems

As already mentioned, there are various ways in which a weight can be attachehyperpath. Depending on the weight measure used to assign a weight to a hyperpproblem can be polynomially solvable or NP-hard. For example, in[11] it has been shownthat the problem of finding minimumcosthyperpaths in a directed hypergraph is NP-haConversely, when we take into consideration inductively defined measures, it is poto characterize a number of cases in which the problem can be solved in polynomiaExamples of inductively defined measures that can be computed in polynomial timthe rank and thegap [21]. Observe that cost, rank and gap are all generalizations ostandard notion of distance in graphs, which can be computed in polynomial time.

The more general approach for finding minimum weight hyperpaths in a functdirected hypergraph is finding afixed pointof the following set of equations, known ageneralized Bellman–Ford equations(see, e.g.,[17,31]):

L(v) ={

0 if v ∈ S,

mine∈bstar(v){fe(we,ψe(x1, x2, . . . , xk))} if v ∈ N \ S,

where tail(e) = {x1, x2, . . . , xk}, andfe andψe depend on the particular weight measuused. The complexity of this problem strongly depends on the characteristics oftionsfe andψe, since, as we will see in the remainder of this section, the solution ogeneral problem can be achieved in several cases by a Dijkstra-like computation. Cof weight functions that can be managed by Dijkstra’s algorithm have been first introin [22] in the framework of context-free grammars as follows:

Definition 3.1. A functiong(x1, . . . , xk) from (R+)k to R+ is:

• superior(SUP) if it is monotone nondecreasing in each variable andg(x1, . . . , xk) �max{x1, . . . , xk}. If the inequality is strict, theng is strict superior(SSUP).

• inferior (INF) if it is monotone nondecreasing in each variable andg(x1, . . . , xk) �min(x1, . . . , xk). If the inequality is strict, theng is strict inferior (SINF).

34 G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46

Examples of superior functions are max1�i�k{xi}, and∑k

i=1 xi . Examples of inferior

been

for

1

that.n

nd,

nd,

hs. Re-

functions are min1�i�k{xi}, and∏k

i=1{xi} when 0� xi � 1, i = 1, . . . , k.Successively, the following generalization of superior (inferior) functions have

considered in[12,22,31]:

Definition 3.2. A functiong(x1, . . . , xk) from (R+)k to R+ is:

• weakly superior(WSUP) if it is monotone nondecreasing in each variable and,1� i � k, if g(x1, . . . , xk) < xi ⇒ g(x1, . . . , xi, . . . , xk) = g(x1, . . . ,∞, . . . , xk);

• weakly inferior(WINF) if it is monotone nondecreasing in each variable and, for�i � k, if g(x1, . . . , xk) > xi ⇒ g(x1, . . . , xi, . . . , xk) = g(x1, . . . ,−∞, . . . , xk).

Examples of weakly superior functions that are not superior are min1�i�k{xi},min1�i�k{xi} ∗ 2, and any constant function. Examples of weakly inferior functionsare not inferior functions are max1�i�k{xi}, max1�i�k{xi}/2, and any constant function

The classes ofstrict weakly superior, andstrict weakly inferiorfunctions have also beeconsidered in[12,22,31], as defined below.

Definition 3.3. A functiong(x1, . . . , xk) from (R+)k to R+ is:

• strict weakly superior(SWSUP) if it is monotone nondecreasing in each variable afor 1� i � k, if g(x1, . . . , xk) � xi ⇒ g(x1, . . . , xi, . . . , xk) = g(x1, . . . ,∞, . . . , xk);

• strict weakly inferior(SWINF) if it is monotone nondecreasing in each variable afor 1� i � k, if g(x1, . . . , xk) � xi ⇒ g(x1, . . . , xi, . . . , xk) = g(x1, . . . ,−∞, . . . , xk).

Let us now see how the above defined classes of functions relate to hypergrapmember that in a functional directed hypergraph, each hyperarce ∈ H is associated toa triple (we,ψe, fe), thus defining a functionge as a combination offe andψe. Givene = 〈X, t〉, with X = {x1, x2, . . . , xk}, the weightµ of any hyperpathΠS,t havinge as thelast hyperarc is given byµ(ΠS,t ) = ge(we,µ(ΠS,x1),µ(ΠS,x2), . . . ,µ(ΠS,xk

)). If func-tionsge, for all e ∈ H, are, say, superior functions, then the overall weight measureµ issuperior as well (with respect to argumentsµ0 andwe, for each hyperarce in the con-

Fig. 2. Properties of hyperpath weight measures.

G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46 35

sidered hyperpath). The table inFig. 2 summarizes the properties of the weight measureserningmposi-ivencase of

truc-bysibleram-

cted

eight

e,

p-

mented

known in the literature with respect to the classes of functions defined above. Concthe relationship among the different classes of weight measures, as well as their cotions, we refer to[12]. Notice that, the classification of gap, rank and traversal cost gin Fig. 2 could be inappropriate in some degenerate cases, as for example, in thehyperpaths containing only one hyperarc.

The generalization of Dijkstra’s algorithm to directed hypergraphs (or similar stures) was first tackled by Martelli and Montanari in[26] and subsequently extendedKnuth in [22]. For weight measures based on superior (inferior) functions, it is posto determine minimum (maximum) cost derivation trees in a weighted context free gmar (or, equivalently, a minimum (maximum) weight hyperpath in a functional direhypergraph) in O(size(H) + m logn) worst case time (or O(size(H) + n logn) by usingFibonacci heaps[16]). This result was subsequently extended in[12,27,31]to weakly su-perior (inferior) functions, thus including all weight measures inFig. 2. In [12], it is alsoshown how the suitability of Dijkstra-based algorithms is related to the properties of wmeasures and to the existence of particular types of cycles in hypergraphs.

4. Maintaining minimum weight hyperpaths

Let H = 〈N,A;F 〉 be a functional directed hypergraph withn nodes andm hyperarcs.We assume that the weight of any minimum weight hyperpath inH is an integer in theinterval [1,C]; for example, if all hyperarc weights are integers in[1,wMAX], then in thecase of the rank and gap weight measure we haveC � n · wMAX, while in the case of thebottleneck weight measure we haveC � wMAX.

Here, we consider the problem of maintaining minimum weight hyperpaths ofH in thefollowing partially dynamic settings:

incremental: hyperarc weight decrements and hyperarc insertions are allowed;decremental: hyperarc weight increments and hyperarc deletions are allowed.

We denote byH′ the hypergraph obtained fromH after applying a weight changan insertion or a deletion to hyperarce = 〈X,y〉, and by w(v) (w′(v)) the weight of theminimum weight hyperpath from a fixed source setS to v in H (H′). Analogously, p(v)

(p′(v)) denotes the port ofv in H (H′).HypergraphH is represented by associating to each nodev two simple lists con-

taining all hyperarcs in bstar(v) and fstar(v). Minimum weight hyperpaths are reresented as follows. For each nodev, we store weight(v), that coincides with w(v)

(w′(v)) before (after) the update, and port(v), that coincides with p(v) (p′(v)) before(after) the update. For each hyperarce in H, we explicitly store the valueG(e) =ge(we,weight(x1),weight(x2), . . . ,weight(xk)), where{x1, x2, . . . , xk} = tail(e). In orderto keep the space occupancy within O(size(H)), we explicitly represent each hyperarc inHonly once; all the occurrences of hyperarcs in the above data structures are impleas references.

36 G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46

In a minimization problem, as a consequence of a hyperarc weight increment (decre-reaseweight

ximiza-

ns

thsn

e

versal

rmalemen-rithm,emen-

edureiled

nly

after

ement

ment) or a hyperarc deletion (insertion), the weight of some hyperpath may inc(decrease) or some hyperpaths may disappear (appear), and the weight of minimumhyperpaths can only increase (decrease). Analogous considerations hold for a mation problem.

In what follows, we tackle the minimization problem and assume that the functioge

areSWSUP, for each hyperarce in H. For example, it is sufficient thatfe andψe are bothmonotone nondecreasing (nonincreasing), and eitherfe or ψe is SWSUP. Since allSSUPfunctions areSWSUP, our algorithms are able to maintain minimum weight hyperpaunder the rank and traversal cost weight measures (seeFig. 2). The same algorithms cabe adapted to deal withSWINFfunctions.

A fundamental step in our procedures is updating the value ofG(e). In the complexityanalysis we assume that for any hyperarce in H this can be done within the following timbounds:

T1. ge(we, x1, x2, . . . , xk) can be maintained under increments ofwe within O(1) worstcase time;

T2. ge(we, x1, x2, . . . , xk) can be maintained under increments of anyxi within O(1)

amortized time over an arbitrary sequence of weight increment operations.

It is simple to see that bounds T1 and T2 can be accomplished for the rank and tracost weight measures.

In the following, we introduce an incremental and a decremental algorithm. The foproof of correctness and the complexity analysis are given in detail only for the decrtal case. The incremental case, which is a straightforward extension of Dijkstra’s algois provided here for the sake of completeness. For the complexity analysis of the incrtal case we assume that bounds T1 and T2 apply to the maintenance ofge under weightdecrements.

4.1. The incremental problem

In this section, we describe ProcedureWeight_Decrease that maintains theminimum weight hyperpaths ofH from a fixed sourceS ⊂ N to all other nodesof H under hyperarc weight decrements. We then discuss how to modify ProcWeight_Decrease in order to handle hyperarc insertions. The algorithm is detain Fig. 3.

First of all, we observe that the weight decrement of hyperarce = 〈X,y〉 in H can onlyaffect nodes reachable fromy in H, and the minimum weight of these nodes can odecrease. We thus concentrate on the nodes inH reachable fromy.

ProcedureWeight_Decrease explores the set of nodes whose weight changesdecreasing the weight of hyperarce = 〈X,y〉, starting from nodey, and examining theaffected nodes by increasing minimum weight. Nodes affected by the weight decrare temporarily stored in an array of sets of nodes, named NewWeightSet. A nodev is putin NewWeightSet(i) if and only if its weight decreases toi.

G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46 37

Procedure Weight_Decrease(e = 〈X,y〉; δ)

thd, if onein the

reasing

ght ofline 13.se see

red, thes (see

xity is

1. we ← we − δ

2. updateG(e)

3. if G(e) � weight(y) then EXIT4. NewWeightSet(G(e)) ← {y}5. port(y) ← e

6. weight(y) ← G(e)

7. for i ← G(e) to C do8. foreach v ∈ NewWeightSet(i) do9. deletev from NewWeightSet(i)10. foreach e′ ∈ fstar(v) do11. updateG(e′)12. letz be head(e′)13. if G(e′) < weight(z) then14. if z ∈ NewWeightSet(weight(z)) then15. deletez from NewWeightSet(weight(z))16. insertz into NewWeightSet(G(e′))17. port(z) ← e′18. weight(z) ← G(e′)19. endfor20. endfor21. endfor

Fig. 3. ProcedureWeight_Decrease.

The algorithm works forSWSUPweight functions. In fact, the weight of a hyperpadepends on the weights of nodes and hyperarcs in the hyperpath. On the other hanof these values is greater or equal than the function value, then it is not relevant,sense that, as can be seen byDefinition 3.3, this value can grow to+∞ without affectingthe function value. Thus, the head of each hyperarc in a minimum hyperpath fromS to v

have weight less than w′(v).Let us observe what happens in line 13: since nodes are examined by non-dec

weight, if there was a hyperpathπ from S to z having weight less thani, the head ofeach hyperarc inπ should have been already examined. In this case the port and weieach node in this hyperpath would have been already assigned, and the condition inwould be false. This implies that values assigned in lines 5, 6, 17 and 18 are correct

The complexity of ProcedureWeight_Decrease strictly depends on which nodeare inserted in and extracted from NewWeightSet. By conditions in lines 3 and 13, wthat only nodes whose weight changes are considered. Any time a node is considedominating cost is due to scanning its forward star and updating hyperarc weightlines 10 and 11). Since each node weight can decrease at mostC times, and exploitingbound T2, the overall time required for managing any sequence ofL hyperarc weightdecrements is O(L · C + C · size(H)).

Hyperarc insertions can be managed by ProcedureWeight_Decrease by simplychanging the very first lines as follows: in line 1 the new hyperarce must be properlyinserted in the data structures, and in line 2 the value ofG(e) must be computed fromscratch. In this case the bound in T1 does not apply, but the same overall complemaintained ifG(e) can be computed from scratch in O(| tail(e)|) time.

38 G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46

Procedure Weight_Increase(e = 〈X,y〉; δ)

t hy-t

-

portt

shose

cting all

1. we ← we + δ

2. updateG(e)

3. if port(y) �= e or G(e) has not changedthen EXIT4. inserty into NewWeightSet(weight(y))

5. for i ← weight(y) to C do6. foreach v ∈ NewWeightSet(i) do7. deletev from NewWeightSet(i)8. search the firsth in bstar(v) such thatG(h) = i

9. if h existsthen10. port(v) ← h

11. else12. port(v) ← NIL13. weight(v) ← min{G(h) | h ∈ bstar(v)}14. insertv in NewWeightSet(weight(v))

15. foreach e′ ∈ fstar(v) do16. updateG(e′)17. if G(e′) has changedthen18. letz be head(e′)19. if e′ = port(z) and z /∈ NewWeightSet(weight(z)) then20. insertz into NewWeightSet(weight(z))21. endfor22. endfor23. endfor

Fig. 4. ProcedureWeight_Increase.

4.2. A new decremental algorithm

In this section, we describe a new algorithm for maintaining the minimum weighperpaths ofH from a fixed sourceS ⊂ N to all other nodes ofH under hyperarc weighincrements and hyperarc deletions. The algorithm is calledWeight_Increase and isgiven inFig. 4. We consider the case that the weight of a hyperarce is increased by a positive quantityδ, and then discuss how to modify ProcedureWeight_Increase in orderto handle hyperarc deletions.

First of all, we observe that after updatingwe in H, each hyperpath inH that doesnot containe preserves its weight. Hence, w′(v) = w(v) for each nodev whose minimumweight hyperpath inH does not containe. We thus concentrate on the set of nodes inHwhose current minimum weight hyperpath fromS containse. Given one of these nodesv,either w′(v) = w(v), or w′(v) > w(v).

ProcedureWeight_Increase explores the set of nodes whose weight and/orchanges under the update of hyperarce = 〈X,y〉, and builds the new minimum weighhyperpaths as follows. The hypergraph is visited starting from nodey and examining nodeby increasing minimum weight. The visit is pruned any time a hyperarc is found wweight does not change or does not belong to any minimum weight hyperpath.

Each iteration of thefor loop at line 5 identifies the set of nodes having weighti (afterthe update), whose weight and/or port changes due to the hyperarc update, by selenodesv such that w(v) = i, w′(v) = i and p′(v) �= p(v), and all nodesv such that w(v) < i

and w′(v) = i.

G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46 39

Inspected nodes are temporarily stored in an array of sets of nodes, named

tm

operty

ure

at3

htt

s

NewWeightSet. A nodev is put in NewWeightSet(i) if and only if w′(v) is knownto be at leasti. Nodes are extracted from set NewWeightSet(i) by increasing i,and for each nodev we check whether there is a hyperarch ∈ bstar(v) such thatfh(wh,ψh(weight(x1),weight(x2), . . . ,weight(xk))) = i, where{x1, x2, . . . , xk} = tail(h).If this is the case, the weight of nodev is set toi, otherwisev is inserted into some seNewWeightSet(j), wherej > i, for future inspection. In order to improve the algorithperformance, it is convenient to setj as min{G(h) | h ∈ bstar(v)}.

Theorem 4.1. ProcedureWeight_Increase correctly updatesweight(v) andport(v),for each nodev, after increasing the weight of a hyperarc.

Proof. We prove the theorem by showing that, if the weight of hyperarc〈X,y〉 is increasedby a quantityδ, then upon termination ofWeight_Increase(〈X,y〉; δ), for eachnodev, we have weight(v) = w′(v) and port(v) = p′(v). We assume that port(y) = p(y) =〈X,y〉 andG(〈X,y〉) changes as a consequence of the weight increment on〈X,y〉, other-wise minimum weight hyperpaths do not change. We also assume that weight(v) = w(v)

and port(v) = p(v), for each nodev, before executing procedureWeight_Increase.The following properties hold during the execution ofWeight_Increase:

P1. For each hyperarce, G(e) = ge(we,weight(x1),weight(x2), . . . ,weight(xk)), where{x1, x2, . . . , xk} = tail(e).It is sufficient to observe that, any time weight(v) is modified for some nodev(line 13),G(e′) is modified accordingly for anye′ ∈ fstar(v) (line 16). Moreover, ifwe increasesG(e) is updated in line 2.

P2. If v ∈ NewWeightSet(j) for somej , thenweight(v) = j .When a node is inserted into NewWeightSet (see lines 4, 14 and 20), the prtrivially holds. Note that, any time the value of weight(v) is modified at line 13, nodevhas already been extracted from NewWeightSet at line 7.

P3. For each nodev, weight(v) can only increase during the execution of ProcedWeight_Increase.Only the weight of nodes extracted from NewWeightSet can change. Letv be a nodein NewWeightSet(k), for somek � w(y), considered during an iteration of the loopline 6. Due to property P2, weight(v) = k. Nodev can get a new weight value at line 1only if the test at line 9 fails. In this case,G(e′) > k for each hyperarce′ ∈ bstar(v),hence weight(v) > k.

P4. For each nodev, w(v) � weight(v) � w′(v).By assumption, weight(v) = w(v), for each nodev, before processing every weigincrement. Thus, property P3 implies that weight(v) � w(v). It remains to show thaweight(v) � w′(v).Let us assume for the purpose of contradiction thatx is the first node that getweight(x) > w′(x). The value of weight(x) has been set at line 13. Sincexis the first node that gets a “wrong” weight, we know that weight(z) � w′(z),for each nodez �= x. By monotonicity of gh, for each hyperarch ∈ bstar(x),gh(wh,weight(z1),weight(z2), . . . ,weight(zk)) � gh(wh,w′(z1),w′(z2), . . . ,w′(zk)),

40 G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46

where {z1, z2, . . . , zk} = tail(h). Let us denote byG′(h) the valuegh(wh,w′(z1),

o

e

oop at

tut

dure-loop

-

on

s

enrarc

w′(z2), . . . ,w′(zk)). Now, by property P1,G(h) = gh(wh,weight(z1),weight(z2), . . . ,

weight(zk)), and, by line 13, weight(x) = minh∈bstar(x) G(h) � minh∈bstar(x) G′(h) =

w′(x), contradicting the assumption that weight(x) > w′(x).P5. If (w(z) �= w′(z)) ∨ (p(z) �= p′(z)) and weight(z) = k, then z is inserted into

NewWeightSet(k).If w(z) �= w′(z) or p(z) �= p′(z), then two cases are possible:1. z ≡ y (wp(z) has been increased). In this case,z has been inserted int

NewWeightSet(weight(z)) at line 4.2. w(v) < w′(v), for somev ∈ tail(p(z)). Sincegp(z) is SWSUP, then it can increas

only due to changes in w(v) such that w(v) < gp(z). This implies that:• v has been increased at least once during the previous iterations of the l

line 5;• hyperarc port(z) has been visited at line 15;• z has been inserted into NewWeightSet(weight(z)) at line 20.

In both cases,z has been inserted into NewWeightSet(weight(z)). It is possible thaweight(z) has been increased again, say froma toa′, during the previous iterations, bin that casez had been moved from NewWeightSet(a) (line 7) to NewWeightSet(a′)(line 14). Since weight(z) is nowk, thenz ∈ NewWeightSet(k).

By exploiting the above properties, we show now that, at the end of ProceWeight_Increase, weight(v) = w′(v) for each nodev. The proof proceeds by induction on the weight values, by studying the behaviour of a single iteration of theat line 5. Letk be the current value of variablei, k � w(y). We show that, during iterationk, if weight(v) = w′(v) for all nodes having weight(v) < k before line 6, thenweight(v) = w′(v) for all nodes having weight(v) � k after line 22.

Basic step: (k < w(y)) Let us consider a minimum weight hyperpathΠS,v in H such thatµ(ΠS,v) < w(y). Two cases may arise: either〈X,y〉 /∈ ΠS,v , or 〈X,y〉 ∈ ΠS,v .In the first case,µ(ΠS,v) cannot be affected by the increment inw〈X,y〉, hencew′(v) = w(v). In the second case,µ(ΠS,v) can be obtained as the compositiof some functionsgh, for someh ∈ ΠS,v , that use weight(y) andwh as argu-ments. Since allgh areSWSUP, alsoµ(ΠS,v) isSWSUPwith respect to argumentweight(y) andwh’s. Thus, ifµ(ΠS,v) < w(y), thenµ(ΠS,v) is not affected by theincrement inw〈X,y〉, hence w′(v) = w(v).

Inductive step: (k � w(y)) We must show that, after iterationk, if weight(v) = k thenweight(v) = w′(v).

Let us consider a nodev such that weight(v) = k. If w(v) = w′(v), then,thanks to property P4, weight(v) = w′(v). Otherwise, thanks to property P5,v

is in NewWeightSet(k).Nodes in NewWeightSet(k) are examined in the for each loop at line 6. Giv

a nodev ∈ NewWeightSet(k), we distinguish two cases: either there is a hypeh ∈ bstar(v) such thatG(h) = k or not.

If h exists (line 10), then by property P1 it follows thatG(h) = gh(wh,

weight(v1),weight(v2), . . . ,weight(vj )), where{v1, v2, . . . , vj } = tail(h). By the

G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46 41

inductive hypothesis, weight(vi) = w′(vi), for all vi such that weight(vi) <

-

on thehangeent in

loop

array

r node,

tliesof

ty

ine 16

G(h). Moreover, since functiongh(wh,weight(v1),weight(v2), . . . ,weight(vj ))

is SWSUP, thengh is invariant with respect to all weight(vi) � G(h).Otherwise, weight(v) is assigned a value greater thank (line 13),v is inserted

into NewWeightSet(weight(v)) (line 14), andv will be considered in a next iteration.

Note that, a nodev gets its correct port any time a hyperarch ∈ bstar(v) is found havingG(h) = w′(v) (line 10). �

In what follows we analyze the time complexity of ProcedureWeight_Increase.The time required to manage a single weight increment operation strongly dependssize of the affected portion of the hypergraph and on the amount of the weight cfor the affected nodes. It is not easy to give a nontrivial upper bound on the time spprocessing a single update, and hence we provide an amortized bound[32], measuring theperformance of our algorithm on a whole sequence of hyperarc weight increments.

Theorem 4.2. The total worst case time needed by ProcedureWeight_Increase forhandling any sequence ofL hyperarc weight increments isO(L · C + C · size(H)).

Proof. TermL · C in the stated complexity bound comes from the cost of the doublein lines 5 and 6.

The cost of lines 1 to 3 is O(1), due to condition T1.Algorithm Weight_Increase examines nodes in NewWeightSet(i), for i = w(y),

. . . ,C (loops at line 5 and 6). Sets NewWeightSet are implemented by means of anof C lists, in which theith list contains all nodes in NewWeightSet(i). Insertion of a nodecan be done in constant time. Node deletions are also performed in constant time pesince all nodes in NewWeightSet(i) are sequentially deleted in the same loop (line 7).

Let us observe what happens when a nodev is extracted from NewWeightSet(i), forsome w(y) � i � C: either there is a hyperarce ∈ bstar(v) such thatG(e) = i (line 10),or weight(v) gets a value strictly greater thani (line 12). In the latter case,v is insertedinto NewWeightSet(weight(v)) at line 14. The value weight(v) can only increase whileprocessing a hyperarc weight increment (see property P3 in the proof ofTheorem 4.1).Since weight(v) is an integer in[1,C], then it can increase at mostC times during a singleexecution ofWeight_Increase. Moreover, the value w′(v) after processing a weighincrement coincides with w(v) before processing the next weight increment. This impthat weight(v) can increase at mostC times while processing an arbitrary sequencehyperarc weight increments.

Any time a nodev is extracted from NewWeightSet(weight(v))—this happens at mosonce for each possible value of weight(v)—all hyperarcs in fstar(v) are scanned. Bthe above discussion, the loop at line 15 requires an overall O(C · ∑

v∈N | fstar(v)|) =O(C · size(H)) worst case time during any sequence of hyperarc weight increments.

Line 16 is performed any time the value of weight(z) changes, wherez ∈ tail(e′), foreach hyperarce′. This gives at mostC · | tail(e′)| executions of line 16 for each hyperarce′during the whole sequence of hyperarc weight increments. Since, by condition T2, l

42 G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46

requires O(1) amortized time, it follows that the overall time spent to perform this line is

Theas-

in-tarof-

rarc

,of

edurey

r, eachtotal

yper-

sure a

letions.eight

chof

∑e′∈A C · | tail(e′)| = O(C · size(H)).We show now that the overall time spent at lines 8 and 13 is O(C · m). We imple-

ment bstar(v) as a simple list, in which hyperarcs are stored in any fixed order.value of port(v) is actually implemented as a pointer to a hyperarc in this list. Wesume that, if port(v) �= NIL , then each hyperarch that precedes port(v) in bstar(v) hasG(h) > G(port(v)); since, while performing iterationk of the loop at line 5, the searchline 8 always stops on the first hyperarc havingG(h) = k, this property is always maintained. Thus, when looking for a hyperarc at line 8, we can sequentially scan bs(v)

starting from port(v) or, if port(v) = NIL , we restart scanning from the beginningbstar(v). Since port(v) becomesNIL only when w′(v) > w(v) (line 12), at most one sequential scan of bstar(v) is performed for each different value of weight(v). Hence, line 8requires O(|bstar(v)|) worst case time for each possible value of weight(v), giving over-all O(C · ∑v∈N |bstar(v)|) = O(C · m) worst case time during any sequence of hypeweight increments.

The execution of line 13 requires a whole scan of bstar(v) any time weight(v) increasesthus giving O(C · ∑

v∈N |bstar(v)|) = O(C · m) worst case time during any sequencehyperarc weight increments.

Summing up the above bounds, it follows that the worst case time required by ProcWeight_Increase to manage a sequence ofL hyperarc weight increments is given bO(L · C + C · m + C · size(H)). Sincem � size(H), the thesis follows. �

Concerning the space requirements, in addition to sets bstar(v) and fstar(v), we onlyneed to represent constant size information with each node and hyperarc. Moreovenode occurs in at most one of the sets in NewWeightSet at a time. It follows that theworst case space needed by ProcedureWeight_Increase is O(C + size(H)).

4.3. Dealing with hyperarc deletions

The main problem in managing hyperarc deletions on a functional directed hgraphH is detecting unreachable nodes. The approach of procedureWeight_Increasecannot be directly extended to manage hyperarc deletions, since we cannot enmonotonicityproperty on hyperpaths. In fact, due toDefinition 3.3, in the case ofSWSUPweight functions, if a hyperpathΠS,v is a proper subhypergraph of hyperpathΠS,w, thenΠS,v andΠS,w may have the same weight. Instead, in the case ofSSUPweight functions,the weight is strictly increasing along a hyperpath.

Actually, reachability is only related to the structure of hypergraphH, not to the par-ticular weight function. Thus, unreachable nodes can be detected onH by maintainingminimum weight hyperpaths in the simple case of therank weight function, with unit hy-perarc weights, under a sequence of hyperarc weight increments and hyperarc deThis is only done in order to detect unreachable nodes before updating minimum whyperpaths under the actualSWSUPweight function.

ProcedureDetect_Unreachable, shown inFig. 5, is based on the same approaas ProcedureWeight_Increase, but weight values are computed on the basisthe rank weight functions. Thus, each nodev is associated to its current rport(v) (the

G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46 43

Procedure Detect_Unreachable(e = 〈X,y〉)

f

wLevel

undrank

he

edrbitrary

1. removee from the hypergraph2. if rport(y) �= e then EXIT3. NewLevel(rank(y)) ← {y}4. for i ← rank(y) to n do5. foreach v ∈ NewLevel(i) do6. deletev from NewLevel(i)7. search the firsth in bstar(v) such that Trank(h) = i

8. if h existsthen9. rport(v) ← h

10. else11. rport(v) ← NIL12. if bstar(v) = ∅ then13. rank(v) ← n + 114. else15. MinTrank← min{Trank(h) | h ∈ bstar(v)}16. rank(v) ← min{n + 1,MinTrank}17. insertv in NewLevel(rank(v))

18. foreach f ∈ fstar(v) do19. if rank(v) � Trank(f ) then20. Trank(f ) ← rank(v) + 121. letz be head(f )

22. if f = rport(z) and z /∈ NewLevel(rank(z)) then23. insertz into NewLevel(rank(z))24. endfor25. endfor26. endfor27. foreach v ∈ NewLevel(n + 1) do28. markv as unreachable29. endfor

Fig. 5. ProcedureDetect_Unreachable.

last hyperarc in the minimum rank hyperpath fromS to v), rank(v) (the analogous oweight(v), storing the current rank value), and for each hyperarce, we store the valueTrank(e) = max{rank(v) | v ∈ tail(e)} + 1 (the analogous ofG(e)).

Inspected nodes are temporarily stored in an array of sets of nodes, denoted as Ne(corresponding to sets NewWeightSet). A nodev is put in NewLevel(i) if and only if itsnew rank value is known to be at leasti. With respect to ProcedureWeight_Increase,an additional set NewLevel(n + 1) is maintained, that contains the nodes that are foto be unreachable fromS after the deletion. These are the nodes whose minimumexceeds the maximum allowed value.

The correctness of ProcedureDetect_Unreachable can be proven by followingthe same line of the proof ofTheorem 4.1, and exploiting the monotonicity property on trank weight function. Concerning the cost of ProcedureDetect_Unreachable, in away similar to the proof ofTheorem 4.2it is possible to show that the overall time needto update minimum rank hyperpaths and to detect unreachable nodes during an asequence of hyperarc deletions is O(n · size(H)).

44 G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46

Based on the above considerations, we can extend ProcedureWeight_Increase totions as

es notProce-orm

by per-

deleted

e of

koverall

yper-es andprob-

tized

mini-fter anynce ofexpect

sentedvery

valid,itrarilyally visitexpect

manage intermixed sequences of hyperarc weight increments and hyperarc delefollows.

In the case of a hyperarc weight increment, the topology of the hypergraph dochange, therefore also unit weight minimum rank hyperpaths are unchanged, anddureWeight_Increase is performed. In the case of a hyperarc deletion, we perfthe following steps:

1. minimum rank hyperpaths are updated and unreachable nodes are detectedforming ProcedureDetect_Unreachable;

2. unreachable nodes, and the corresponding backward and forward stars, arefrom the hypergraph;

3. any nodev whose port has been deleted is put into NewWeightSet(weight(v)), and itsport is set tonil;

4. ProcedureWeight_Increase is performed, starting from line 5.

The worst case time required by the above algorithm for handling any sequencL

intermixed hyperarc weight increments and hyperarc deletions is O(L · C + max{n,C} ·size(H)). This easily follows fromTheorem 4.2and from the fact that minimum ranhyperpaths in the case of unit hyperarc weights can be decrementally maintained inO(n · size(H)) worst case time.

5. Concluding remarks

We have considered the problem of dynamically maintaining minimum weight hpaths in a directed hypergraph subject to modifications as hyperarc weight changhyperarc insertions or deletions. We have proposed a decremental solution for thislem that works for a wide class of weight functions and is efficient in terms of amorcomplexity.

The algorithms proposed in this paper can easily be extended in order to updatemum weight hyperpaths after a batch of updates, instead of adjusting hyperpaths asingle hyperarc update. Although the worst case time required to deal with a sequebatched updates asymptotically equals the bounds proved for the single updates, wethe batched approach to be faster in practice.

A possible future research direction could be to apply some of the techniques prein this paper to the fully-dynamic problem. It is easy to see that our algorithm could beeasily extended to a fully-dynamic one. Anyway, the complexity analysis is no longersince if we intermix weight increments and decrements then weight values can arbincrease and decrease. Nevertheless, due to the fact that these algorithms essentionly nodes whose weight changes, and their incoming and outgoing hyperarcs, wethem to be fast in practice.

G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46 45

Acknowledgements

ct-freeLec-

encepplica-ce,

0 (4)

5 (2)

rpathse EU

put.

ogic

mput.

R-92-

rithms,Com-

Intelli-

2.rithms,

ected

Appl.

rt TR-

roach,

ce on

CSLI

The authors are grateful to the anonymous referees for their careful revisions.

References

[1] P. Alimonti, E. Feuerstein, U. Nanni, Linear time algorithms for liveness and boundedness in confliPetri nets, in: Proceedings of Latin American symposium on Theoretical INformatics (LATIN’92), in:ture Notes in Computer Science, vol. 583, Springer-Verlag, Berlin, 1992, pp. 1–14.

[2] C. Alonso, B. Pulido, G.G. Acosta, On line industrial diagnosis: an attempt to apply artificial intelligtechniques to process control, in: Proc. 11th International Conference on Industrial and Engineering Ations of Artificial Intelligence and Expert Systems (IEA-98-AIE), in: Lecture Notes in Artificial Intelligenvol. 1415, Springer-Verlag, Berlin, 1998, pp. 804–813.

[3] H.R. Andersen, Model checking and boolean graphs, Theoret. Comput. Sci. 126 (1) (1994) 3–30.[4] J. Aráoz, Forward chaining is simple(x), Oper. Res. Lett. 26 (2000) 23–26.[5] G. Ausiello, A. D’Atri, D. Saccà, Graph algorithms for functional dependency manipulation, J. ACM 3

(1983) 752–766.[6] G. Ausiello, A. D’Atri, D. Saccà, Minimal representation of directed hypergraphs, SIAM J. Comput. 1

(1986) 418–431.[7] G. Ausiello, P.G. Franciosa, D. Frigioni, R. Giaccio, Decremental maintenance of minimum rank hype

and minimum models of Horn formulæ, Technical Report ALCOMFT-TR-01-19, IST Programme of thIST-1999-14186 (ALCOM-FT), 2001,http://www.brics.dk/cgi-alcomft/db?state=reports.

[8] G. Ausiello, R. Giaccio, On-line algorithms for satisfiability problems with uncertainty, Theoret. ComSci. 171 (1–2) (1997) 3–24.

[9] G. Ausiello, G.F. Italiano, On-line algorithms for polynomially solvable satisfiability problems, J. LProgramming 10 (1/2/3–4) (1991) 69–90.

[10] G. Ausiello, G.F. Italiano, U. Nanni, Dynamic maintenance of directed hypergraphs, Theoret. CoSci. 72 (2–3) (1990) 97–117.

[11] G. Ausiello, G.F. Italiano, U. Nanni, Optimal traversal of directed hypergraphs, Technical Report T073, International Computer Science Institute, Berkeley, CA, September 1992.

[12] G. Ausiello, G.F. Italiano, U. Nanni, Hypergraph traversal revisited: Cost measures and dynamic algoin: Symposium on Mathematical Foundations of Computer Science (MFCS’98), in: Lecture Notes inputer Science, vol. 1450, Springer-Verlag, Berlin, 1998, pp. 1–16.

[13] C. Berge, Graphs and Hypergraphs, North-Holland, Amsterdam, 1973.[14] H. Boley, Directed recursive labelnode hypergraphs: A new representation language, Artificial

gence 9 (1) (1977) 49–85.[15] J. de Kleer, An assumption based truth maintenance system, Artificial Intelligence 28 (1986) 127–16[16] M.L. Fredman, R.E. Tarjan, Fibonacci heaps and their uses in improved network optimization algo

J. ACM 34 (3) (1987) 596–615.[17] G. Gallo, C. Gentile, D. Pretolani, G. Rago, Max Horn SAT and the minimum cut problem in dir

hypergraphs, Math. Programming 80 (1998) 213–237.[18] G. Gallo, G. Longo, S. Nguyen, S. Pallottino, Directed hypergraphs and applications, Discrete

Math. 42 (1993) 177–201.[19] G. Gallo, G. Rago, A hypergraph approach to logical inference for datalog formulæ, Technical Repo

28/90, Dipartimento di Informatica, Università di Pisa, Italy, 1990.[20] S. Gnesi, U. Montanari, A. Martelli, Dynamic programming as graph searching: An algebraic app

J. ACM 28 (4) (1981) 737–751.[21] G.F. Italiano, U. Nanni, On-line maintenance of minimal directed hypergraphs, in: Italian Conferen

Theoretical Computer Science, 1989, pp. 335–349.[22] D.E. Knuth, A generalization of Dijkstra’s algorithm, Inform. Process. Lett. 6 (1) (1977) 1–5.[23] K. Konolige, Abductive theories in artificial intelligence, in: Principles of Knowledge Representation,

Publications, 1996, pp. 129–152.

46 G. Ausiello et al. / Journal of Discrete Algorithms 3 (2005) 27–46

[24] X. Liu, S.A. Smolka, Simple linear-time algorithms for minimal fixed points, in: International Colloquium. 1443,

e Sys-

ficial

ecture

, Uni-

J. Oper.

, J. Al-

306–

Com-

on Automata, Languages and Programming (ICALP’98), in: Lecture Notes in Computer Science, volSpringer-Verlag, Berlin, 1998, pp. 53–65.

[25] D. Maier, J.D. Ullman, Connections in acyclic hypergraphs, in: Symposium on Principles of Databastems (PODS’82), ACM Press, 1982, pp. 34–39.

[26] A. Martelli, U. Montanari, Additive and/or graphs, in: Proc. 3rd International Joint Conference on ArtiIntelligence (IJCAI’73), 1973, pp. 1–11.

[27] S. Nguyen, S. Pallottino, Hypergraphs and shortest hyperpaths, in: Combinatorial Optimization, in: LNotes in Mathematics, vol. 1403, Springer-Verlag, Berlin, 1986, pp. 258–271.

[28] N.J. Nilsson, Problem Solving Methods in Artificial Intelligence, McGraw-Hill, New York, 1971.[29] D. Pretolani, Satisfiability and hypergraphs, Technical Report TD-12/93, Dipartimento di Informatica

versità di Pisa, Italy, 1993.[30] D. Pretolani, A directed hypergraph model for random time dependent shortest paths, European

Res. 123 (2000) 315–324.[31] G. Ramalingam, T. Reps, An incremental algorithm for a generalization of the shortest-path problem

gorithms 21 (2) (1996) 267–305.[32] R.E. Tarjan, Amortized computational complexity, SIAM J. Algebraic Discrete Methods 6 (2) (1985)

318.[33] J.D. Ullman, Principles of Database Systems, Computer Science Press, 1982.[34] H.C. Yen, A unified approach for deciding the existence of certain Petri net paths, Inform. and

put. 96 (1) (1992) 119–137.