directed hypergraphs algorithms and applications

of the unfolded representation of hyperpath (hyperpath tree). .... is monotone non decreasing in each variable and .... applications, Discrete Applied Math., 1993.
807KB taille 5 téléchargements 373 vues
DIRECTED HYPERGRAPHS ALGORITHMS AND APPLICATIONS Giorgio Ausiello Joint work with L. Laura, G.F. Italiano, U. Nanni September 2011

6. MINIMUM HYPERPATHS IN DIRECTED HYPERGRAPHS In the case of directed graphs the computation of shortest path is a well known ‘easy’ problem. This is not the case for directed hypergraphs. Again a long history: • Martelli, Montanari 1973 • Knuth 1977 • Nguyen, Pallottino 1988 • Italiano, Nanni 1992 • Ramalingam, Reps 1996 • A., Laura, Italiano, Nanni 1998 - 2011

Shortest Hyperpath Problems The following shortest hyperpath problems are NP-hard: • minimum number of hyperarcs • minimum size • minimum source area • minimum number of source sets (!) Reduction from SET-COVER. By means of approximation preserving reductions it is easy to show that all problems are log-APX-hard to approximate.

Reduction from SET-COVER Let us consider an instance of the SET-COVER decision problem: a universe A = {e1, e2, …, en}, a family of sets S1, S2, …, Sm A, an integer k. We can construct a hypergraph such that there exists a hyperpath from node p to node t with k+n+1 hyperarcs iff there exists a set cover with k sets.

Measuring hyperpaths On directed hypergraphs a variety of measures can be defined , all collapsing into the usual notion of cost of a path when the hypergraph is a digraph. In some cases such measures lead to tractable (polynomial time) minimum hyperpath problems that are also easy to maintain in the dynamic case.

Examples • Rank of a hyperpath: maximum number of arcs traversed. • Gap of a hyperpath: minimum number of arcs traversed. (See next figure - A formal definition will be provided later) Interpretation in transition systems: no information can arrive from source to target of a hyperpath before gap ( ) steps; all information arrives after rank ( ) steps.

Gap and Rank

Left Hyperpath Gap=3 Rank=4

Right Hyperpath Gap=2 Rank=5

In order to characterize tractable minimum hyperpath problems and provide algorithms we need to introduce inductively defined cost measures based on the structure of the unfolded representation of hyperpath (hyperpath tree).

An example of the folded an unfolded representation of hyperpath (hyperpath tree).

Let H = be a weighted hypergraph An inductively defined measure µ over a weighted directed hypergraph is characterized by a triple µ = (µ0, ψ, f) where: µ0 : measure of an empty hyperpath (normally equal to zero) ψ : combination of costs on the source set f : composition of ψ and w and is defined as follows: µ (∅) = µ0 µ (hZ, t) = f (wX,t, ψ (µ(hZ, x1), µ(hZ, x2), …, µ(hZ, xn)) if hZ, t is the hyperpath: (Z, x1), (Z, x2), …, (Z, xn), (X, t) and X = {x1, x2, …, xn}

Example. In the most intuitive case of the ‘traversal cost’ (c) of an unfolded hyperpath (where we sum up over the cost of all traversed hyperarcs) we have : c = (0, +, +), that is: c(∅) = 0 c(hZ, t) = wX,t + ∑ (c(hZ, x1), c(hZ, x2), …, c(hZ, xn))

Other examples of inductively defined cost measures: Gap: g = (0, min, +) g (∅) = 0 g (hZ, t) = wX,t + min (g(hZ, x1), g(hZ, x2), …, g(hZ, xn)) Rank: r = (0, max, +) r (∅) = 0 r (hZ, t) = wX,t + max (r(hZ, x1), r(hZ, x2), …, r(hZ, xn)) Bottleneck: b = (∞, min, min) b (∅) = ∞ b (hZ, t) = min{wX,t, min (b(hZ, x1), b(hZ, x2), …, b(hZ, xn))

Threshold: t = (0, max, max) t (∅) = 0 t (hZ, t) = max{wX,t, max (t(hZ, x1), t(hZ, x2), …, t(hZ, xn)) Average-depth: avg = (0, average, +) avg (∅) = 0 avg (hZ, t) = wX,t + average (avg(hZ, x1), avg(hZ, x2), …, avg(hZ, xn)) Path-product: pp = (1, ∏, ∗) pp (∅) = 1 pp (hZ, t) = wX,t ∗ ∏ (pp(hZ, x1), pp(hZ, x2), …, pp(hZ, xn))

Algorithms for the computation of shortest hyperpath heavily depend on the properties of functions ψ and f In order to point out such differences see the following examples.

The most general formulation of (single source) shortest hyperpath problems can be provided by Bellman-Ford equations. Example Of Bellman-Ford equations for graphs

A=0 B=A+2 C=min(A+4, B+1) D=B+1 E=min(C+2, D+1)

Solution: A=0 B=2 C=3 D=3 E=4

Generalization: Bellman-Ford equations for shortest hyperpaths in hypergraphs. The case of the rank measure. ψ=‘max’ and f= ‘+’ A=0 B=A+1 C=min(A+6, D+1) D=max(B,C) +1 E=D+1

Solution: A=0 B=1 C=6 D=7 E=8

Generalization: Bellman-Ford equations for shortest hyperpaths in hypergraphs. The case of the average measure. ψ=‘average’ and f= ‘+’ A=0 B=A+1 C=min(A+6, D+1) D=average(B,C) +1 E=D+1

Solution: A=0 B=1 C=5 D=4 E=5

Note that more generally we may have that: - the functions ψ and f may be different from hyperarc to hyperarc - the source set of a hyperarc should be defined as an ordered tuple because the composition function ψ might not be associative and commutative.

Functional directed hypergraph HF = where F establishes a correspondence between any hyperarc (X, t) in H and three entities: - a weight wX,t - a function ψ such that ψX,t : D|X| → D - a function f such that f X,t : D2 → D

Related formulations • Minimization of superior context-free grammars (Knuth 1977) • Minimization of additive weighting functions (Nguyen, Pallottino 1988) • Monotone systems of polynomial equations (Esparza et al. 2008)

Minimization of superior context free grammars Productions: θ : Y → gθ (X1, …, Xn) n≥ 0 Y, X1, …, Xn ∈ VN ; gθ , (, ), , ∈ VT where ∀θ gθ is monotone non decreasing in each variable and ∀θ gθ (x1, …, xn) ≥ max{ xi | i = 1, …, n} (superior functions: e.g. max (x, y), (x + y) etc. ) Language: L(Y) = { α | α ∈ VT* and Y ⇒ α} (e.g. = max ( (3 +1), (4 + max(2, 3)))) Val (α ) ∈ ℜ+ Problem: Given a superior context free grammar and given the axiom Y find α in L(Y) such that Val (α) is minimum.

Classification of the functions ψ and f Superior functions (SUP): g monotone non decreasing in each variable and g (x1, …, xn) ≥ max{ xi | i = 1, …, n} Examples: max (x, y), (x + y), etc. Measures: traversal cost, rank, threshold, path-product [1, + ∞) Strictly superior functions (SSUP): g monotone non decreasing in each variable and g (x1, …, xn) > max{ xi | i = 1, …, n}, Examples: x + y with positive variables Measures: traversal cost, rank with positive weights, pathproduct (1, + ∞)

Weakly superior functions (WSUP): g monotone non decreasing in each variable and g (x1, …, xn) < xi → g (x1, …, xi, …, xn) = = g (x1, …, ∞, …, xn) Clearly SSUP ⊂ SUP ⊂ WSUP Examples of WSUP\SUP functions are min {x, y} and constant functions. Measures: gap, bottleneck

Similar approach can be used in a suitable way to define: Inferior functions Weakly inferior functions Clearly SINF ⊂ INF ⊂ WINF Measures based on functions in INF: bottleneck, path-product [0, 1] Measures based on functions in WINF\INF: threshold

In the following we will see how (and under what costs) Dijkstra algorithm can be extended to compute optimum hyperpaths for measures based on superior functions and on weakly superior functions. Similar approach can used for extending Dijkstra algorithm to compute optimum hyperpaths for measures based on inferior functions and on weakly inferior functions.

Dijkstra algorithm scheme. Constructs single source shortest path tree (spt) starting from node x. Let G = be a weighted digraph. For any n ∈ N set d(n)=∞ and set visited (n) = FALSE. Enqueue x with priority d(x) = 0 in priority queue Q. While Q not empty do u = Extract-min (Q); visited (u) = TRUE; insert edge (father (u), u) in spt; for each (u,v) in A do if v not visited and d(v) > d(u) + w(u,v) then father (v) = u d(v) = d(u) + w(u,v) Enqueue (v) or Update (v) in Q with priority d(v)

Algorithm 1 - Let H = be a directed hypergraph. Let µ be an inductively defined measure based on superior functions. Algorithm 1 computes all single source shortest distances starting from source set S. For any n ∈ N set d(n)=∞ and set visited (n) = FALSE. ∀x ∈ S Enqueue x with priority d(x) = µ0 in priority queue Q. While Q not empty do u = Extract-min (Q); visited (u) = TRUE; for each hyperarc (X, v) in H where X = {x1 … xk} such that u ∈ {x1,.., xk} and ∀xi xi visited

if v not visited and d(v) > µ(S, v) = f (wX,v, ψ (µ(hS, x1), µ(hS, x2), …, µ(hS, xn)) then d(v) = µ(S, v) Enqueue (v) or Update (v) in Q with priority d(v)

Algorithm 1 computes all shortest distances from source set S in time O(|H| log |N| + |H |). Cost can be reduced to O(|N| log |N| + |H |) by making use of Fibonacci heaps for implementing the priority queue.

Algorithm 1 can be applied to minimization of measures based on superior functions. It can be easily extended to deal with maximization of measures based on inferior functions. See also Martelli, Montanari 1973: computation of traversal cost in and-or graphs.

A hard instance with a weakly superior function: gap Remember: g (hZ, t) = wX,t + min (g(hZ, x1), g(hZ, x2), …, g(hZ, xn))

In the previous example we have the following sequence of steps: Extract-min (Q) = a3 g(a3) = 6 Extract-min (Q) = a2 g(a2) = 7 Extract-min (Q) = a1 g(a1) = 8 Extract-min (Q) = a0 g(a0) = 9 Enqueue (c0) g(c0) = 10 Extract-min (Q) = c0 Enqueue (c1) g(c1) = 11 Extract-min (Q) = c1 Enqueue (b1) g(b1) = 12 Extract-min (Q) = b1 Now a new link (a1 b1, c0) is created and c0 has to be enqueued again with g(c0) =9 and so on: g(c0) =8, g(c0) =7, etc.

In the example a major role is played by two facts: 1) a node can become reachable from a new source set during the computation and therefore it has to be repeatedly visited during shortest path computation 2) the measure is based on weakly superior functions and therefore the value of the measure can decrease after a cycle has been visited; this cannot happen with superior functions As a consequence the approach of Algorithm 1 would incur into cost O(|N| log |N| + W |H |) where W = # of values of domain (possible values of measure)

Note that in this case convergence is achieved after one scan of cycles (this is true for all measures based on WSUP functions) The next algorithm exploits this fact in order to overcome the difficulty and obtain better performance (same as Algorithm 1). Measures for which convergence is achieved after repeated visits of cycles can also be found and we also saw an example (average) where convergence requires an unbounded number of scans of cycles.

Algorithm 2 - Let H = be a directed hypergraph. Let µ be an inductively defined measure based on superior functions. Algorithm 2 computes all single source shortest distances starting from source set S. 1) Propagate reachability 2) Perform Algorithm 1

Algorithm 2 computes all shortest distances from source set S in time O(|H| log |N| + |H |). Again cost can be reduced to O(|N| log |N| + |H |) by making use of Fibonacci heaps for implementing the priority queue. The algorithm can be extended to deal with maximization problems for measures based on weakly inferior functions.

Exercises Prove that the following problems are NP-hard: • hyperpath with minimum size • hyperpath with minimum source area • hyperpath with minimum number of source sets

Essential references • Ausiello, D’Atri, Sacca’, Minimal representation of directed hypergraphs, SIAM on Comp., 1986 • Ausiello, Italiano, Online algorithms for polynomially solvable satisfiability problems, J. of Logic Prog., 1991 • Gallo, Longo, Nguyen, Pallottino, Directed hypergraphs and applications, Discrete Applied Math., 1993 • Ramalingam, Reps, An incremental algorithm for a generalization of the shortest path problem, J. of Algorithms, 1996 • Esparza, Kiefer, Luttenberger, Solving monotone polynomial equations, 5° IFIP Conf. on Theor. Comp. Sc., 2008 • Ausiello, Italiano, Laura, Nanni, Sarracco, Classification and traversal algorithmic techniques for optimization problems on directed hyperpaths, Tech. Rep. DIS, Sapienza University of Rome 2011