directed hypergraphs algorithms and applications - Free
directed hypergraphs algorithms and applications - Free
directed hypergraphs algorithms and applications - Free
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
DIRECTED HYPERGRAPHS<br />
ALGORITHMS AND APPLICATIONS<br />
Giorgio Ausiello<br />
Joint work with L. Laura, G.F. Italiano, U. Nanni<br />
September 2011
6. MINIMUM HYPERPATHS IN<br />
DIRECTED HYPERGRAPHS<br />
In the case of <strong>directed</strong> graphs the computation of<br />
shortest path is a well known ‘easy’ problem. This is not<br />
the case for <strong>directed</strong> <strong>hypergraphs</strong>.<br />
Again a long history:<br />
• Martelli, Montanari 1973<br />
• Knuth 1977<br />
• Nguyen, Pallottino 1988<br />
• Italiano, Nanni 1992<br />
• Ramalingam, Reps 1996<br />
• A., Laura, Italiano, Nanni 1998 - 2011
Shortest Hyperpath Problems<br />
The following shortest hyperpath problems are NP-hard:<br />
• minimum number of hyperarcs<br />
• minimum size<br />
• minimum source area<br />
• minimum number of source sets (!)<br />
Reduction from SET-COVER.<br />
By means of approximation preserving reductions it is<br />
easy to show that all problems are log-APX-hard to<br />
approximate.
Reduction from SET-COVER<br />
Let us consider an instance of the<br />
SET-COVER decision problem:<br />
a universe A = {e 1, e 2, …, e n},<br />
a family of sets S1, S2, …, Sm an integer k.<br />
A,<br />
We can construct a hypergraph such<br />
that there exists a hyperpath from<br />
node p to node t with k+n+1<br />
hyperarcs iff there exists a set cover<br />
with k sets.
Measuring hyperpaths<br />
On <strong>directed</strong> <strong>hypergraphs</strong> a variety of measures<br />
can be defined , all collapsing into the usual<br />
notion of cost of a path when the hypergraph is<br />
a digraph. In some cases such measures lead to<br />
tractable (polynomial time) minimum hyperpath<br />
problems that are also easy to maintain in the<br />
dynamic case.
Examples<br />
• Rank of a hyperpath: maximum number of arcs<br />
traversed.<br />
• Gap of a hyperpath: minimum number of arcs<br />
traversed.<br />
(See next figure - A formal definition will be<br />
provided later)<br />
Interpretation in transition systems: no information<br />
can arrive from source to target of a hyperpath<br />
before gap ( ) steps; all information arrives after<br />
rank ( ) steps.
Left Hyperpath<br />
Gap=3<br />
Rank=4<br />
Gap <strong>and</strong> Rank<br />
Right Hyperpath<br />
Gap=2<br />
Rank=5
In order to characterize tractable minimum hyperpath<br />
problems <strong>and</strong> provide <strong>algorithms</strong> we need to introduce<br />
inductively defined cost measures based on the structure<br />
of the unfolded representation of hyperpath (hyperpath<br />
tree).
An example of the folded an unfolded representation of<br />
hyperpath (hyperpath tree).
Let H = be a weighted hypergraph<br />
An inductively defined measure µ over a weighted <strong>directed</strong><br />
hypergraph is characterized by a triple µ = (µ 0, ψ, f) where:<br />
µ 0 : measure of an empty hyperpath (normally equal to zero)<br />
ψ : combination of costs on the source set<br />
f : composition of ψ <strong>and</strong> w<br />
<strong>and</strong> is defined as follows:<br />
µ (∅) = µ 0<br />
µ (h Z, t) = f (w X,t, ψ (µ(h Z, x1), µ(h Z, x2), …, µ(h Z, xn)) if h Z, t is<br />
the hyperpath: (Z, x 1), (Z, x 2), …, (Z, x n), (X, t) <strong>and</strong> X = {x 1,<br />
x 2, …, x n}
Example.<br />
In the most intuitive case of the ‘traversal cost’<br />
(c) of an unfolded hyperpath (where we sum up<br />
over the cost of all traversed hyperarcs) we have<br />
: c = (0, +, +), that is:<br />
c(∅) = 0<br />
c(h Z, t) = w X,t + ∑ (c(h Z, x1), c(h Z, x2), …, c(h Z, xn))
Other examples of inductively defined cost measures:<br />
Gap: g = (0, min, +)<br />
g (∅) = 0<br />
g (h Z, t) = w X,t + min (g(h Z, x1), g(h Z, x2), …, g(h Z, xn))<br />
Rank: r = (0, max, +)<br />
r (∅) = 0<br />
r (h Z, t) = w X,t + max (r(h Z, x1), r(h Z, x2), …, r(h Z, xn))<br />
Bottleneck: b = (∞, min, min)<br />
b (∅) = ∞<br />
b (h Z, t) = min{w X,t, min (b(h Z, x1), b(h Z, x2), …, b(h Z, xn))
Threshold: t = (0, max, max)<br />
t (∅) = 0<br />
t (h Z, t) = max{w X,t, max (t(h Z, x1), t(h Z, x2), …, t(h Z, xn))<br />
Average-depth: avg = (0, average, +)<br />
avg (∅) = 0<br />
avg (h Z, t) = w X,t + average (avg(h Z, x1), avg(h Z, x2), …,<br />
avg(h Z, xn))<br />
Path-product: pp = (1, ∏, ∗)<br />
pp (∅) = 1<br />
pp (h Z, t) = w X,t ∗ ∏ (pp(h Z, x1), pp(h Z, x2), …, pp(h Z, xn))
Algorithms for the computation of shortest<br />
hyperpath heavily depend on the properties of<br />
functions ψ <strong>and</strong> f<br />
In order to point out such differences see the<br />
following examples.
The most general formulation of (single source) shortest hyperpath problems can<br />
be provided by Bellman-Ford equations.<br />
Example Of Bellman-Ford equations for graphs<br />
A=0<br />
B=A+2<br />
C=min(A+4, B+1)<br />
D=B+1<br />
E=min(C+2, D+1)<br />
Solution:<br />
A=0<br />
B=2<br />
C=3<br />
D=3<br />
E=4
Generalization: Bellman-Ford equations for shortest hyperpaths in <strong>hypergraphs</strong>.<br />
The case of the rank measure. ψ=‘max’ <strong>and</strong> f= ‘+’<br />
A=0<br />
B=A+1<br />
C=min(A+6, D+1)<br />
D=max(B,C) +1<br />
E=D+1<br />
Solution:<br />
A=0<br />
B=1<br />
C=6<br />
D=7<br />
E=8
Generalization: Bellman-Ford equations for shortest hyperpaths in <strong>hypergraphs</strong>.<br />
The case of the average measure. ψ=‘average’ <strong>and</strong> f= ‘+’<br />
A=0<br />
B=A+1<br />
C=min(A+6, D+1)<br />
D=average(B,C) +1<br />
E=D+1<br />
Solution:<br />
A=0<br />
B=1<br />
C=5<br />
D=4<br />
E=5
Note that more generally we may have that:<br />
- the functions ψ <strong>and</strong> f may be different from<br />
hyperarc to hyperarc<br />
- the source set of a hyperarc should be defined<br />
as an ordered tuple because the composition<br />
function ψ might not be associative <strong>and</strong><br />
commutative.
Functional <strong>directed</strong> hypergraph<br />
H F = where F establishes a<br />
correspondence between any hyperarc (X, t) in H<br />
<strong>and</strong> three entities:<br />
- a weight w X,t<br />
- a function ψ such that ψ X,t : D |X| → D<br />
- a function f such that f X,t : D 2 → D
Related formulations<br />
• Minimization of superior context-free<br />
grammars (Knuth 1977)<br />
• Minimization of additive weighting functions<br />
(Nguyen, Pallottino 1988)<br />
• Monotone systems of polynomial equations<br />
(Esparza et al. 2008)
Minimization of superior<br />
context free grammars<br />
Productions:<br />
θ : Y → g θ (X 1, …, X n) n≥ 0<br />
Y, X 1, …, X n ∈ V N ; g θ , (, ), , ∈ V T<br />
where ∀θ g θ is monotone non decreasing in each variable <strong>and</strong><br />
∀θ g θ (x 1, …, x n) ≥ max{ x i | i = 1, …, n}<br />
(superior functions: e.g. max (x, y), (x + y) etc. )<br />
Language:<br />
L(Y) = { α | α ∈ V T* <strong>and</strong> Y ⇒ α}<br />
(e.g. = max ( (3 +1), (4 + max(2, 3))))<br />
Val (α ) ∈ ℜ +<br />
Problem: Given a superior context free grammar <strong>and</strong> given<br />
the axiom Y find α in L(Y) such that Val (α) is minimum.
Classification of the functions ψ <strong>and</strong> f<br />
Superior functions (SUP): g monotone non decreasing in each<br />
variable <strong>and</strong> g (x 1, …, x n) ≥ max{ x i | i = 1, …, n}<br />
Examples: max (x, y), (x + y), etc.<br />
Measures: traversal cost, rank, threshold, path-product [1, + ∞)<br />
Strictly superior functions (SSUP): g monotone non<br />
decreasing in each variable <strong>and</strong> g (x 1, …, x n) > max{ x i | i =<br />
1, …, n},<br />
Examples: x + y with positive variables<br />
Measures: traversal cost, rank with positive weights, pathproduct<br />
(1, + ∞)
Weakly superior functions (WSUP): g monotone non<br />
decreasing in each variable <strong>and</strong><br />
g (x 1, …, x n) < x i → g (x 1, …, x i, …, x n) =<br />
= g (x 1, …, ∞, …, x n)<br />
Clearly SSUP ⊂ SUP ⊂ WSUP<br />
Examples of WSUP\SUP functions are min {x, y} <strong>and</strong><br />
constant functions.<br />
Measures: gap, bottleneck
Similar approach can be used in a suitable way<br />
to define:<br />
Inferior functions<br />
Weakly inferior functions<br />
Clearly SINF ⊂ INF ⊂ WINF<br />
Measures based on functions in INF: bottleneck,<br />
path-product [0, 1]<br />
Measures based on functions in WINF\INF:<br />
threshold
In the following we will see how (<strong>and</strong> under<br />
what costs) Dijkstra algorithm can be extended<br />
to compute optimum hyperpaths for measures<br />
based on superior functions <strong>and</strong> on weakly<br />
superior functions.<br />
Similar approach can used for extending Dijkstra<br />
algorithm to compute optimum hyperpaths for<br />
measures based on inferior functions <strong>and</strong> on<br />
weakly inferior functions.
Dijkstra algorithm scheme. Constructs single source shortest<br />
path tree (spt) starting from node x. Let G = be a<br />
weighted digraph.<br />
For any n ∈ N set d(n)=∞ <strong>and</strong> set visited (n) = FALSE.<br />
Enqueue x with priority d(x) = 0 in priority queue Q.<br />
While Q not empty do<br />
u = Extract-min (Q); visited (u) = TRUE;<br />
insert edge (father (u), u) in spt;<br />
for each (u,v) in A do<br />
if v not visited <strong>and</strong> d(v) > d(u) + w(u,v)<br />
then father (v) = u<br />
d(v) = d(u) + w(u,v)<br />
Enqueue (v) or Update (v) in Q with priority d(v)
Algorithm 1 - Let H = be a <strong>directed</strong> hypergraph. Let µ<br />
be an inductively defined measure based on superior functions.<br />
Algorithm 1 computes all single source shortest distances starting<br />
from source set S.<br />
For any n ∈ N set d(n)=∞ <strong>and</strong> set visited (n) = FALSE.<br />
∀x ∈ S Enqueue x with priority d(x) = µ 0 in priority queue Q.<br />
While Q not empty do<br />
u = Extract-min (Q); visited (u) = TRUE;<br />
for each hyperarc (X, v) in H where X = {x 1 … x k}<br />
such that u ∈ {x 1,.., x k} <strong>and</strong> ∀x i x i visited<br />
if v not visited <strong>and</strong><br />
d(v) > µ(S, v) = f (w X,v, ψ (µ(h S, x1), µ(h S, x2), …, µ(h S, xn))<br />
then d(v) = µ(S, v)<br />
Enqueue (v) or Update (v) in Q with priority d(v)
Algorithm 1 computes all shortest distances from<br />
source set S in time O(|H| log |N| + |H |).<br />
Cost can be reduced to O(|N| log |N| + |H |) by<br />
making use of Fibonacci heaps for implementing<br />
the priority queue.
Algorithm 1 can be applied to minimization of<br />
measures based on superior functions.<br />
It can be easily extended to deal with<br />
maximization of measures based on inferior<br />
functions.<br />
See also Martelli, Montanari 1973: computation<br />
of traversal cost in <strong>and</strong>-or graphs.
A hard instance with a weakly superior function: gap<br />
Remember: g (h Z, t) = w X,t + min (g(h Z, x1), g(h Z, x2), …, g(h Z, xn))
In the previous example we have the following sequence of<br />
steps:<br />
Extract-min (Q) = a 3 g(a 3) = 6<br />
Extract-min (Q) = a 2 g(a 2) = 7<br />
Extract-min (Q) = a 1 g(a 1) = 8<br />
Extract-min (Q) = a 0 g(a 0) = 9<br />
Enqueue (c 0) g(c 0) = 10 Extract-min (Q) = c 0<br />
Enqueue (c 1) g(c 1) = 11 Extract-min (Q) = c 1<br />
Enqueue (b 1) g(b 1) = 12 Extract-min (Q) = b 1<br />
Now a new link (a 1 b 1, c 0) is created <strong>and</strong> c 0 has to be<br />
enqueued again with g(c 0) =9 <strong>and</strong> so on: g(c 0) =8, g(c 0) =7,<br />
etc.
In the example a major role is played by two facts:<br />
1) a node can become reachable from a new source set during<br />
the computation <strong>and</strong> therefore it has to be repeatedly visited<br />
during shortest path computation<br />
2) the measure is based on weakly superior functions <strong>and</strong><br />
therefore the value of the measure can decrease after a cycle<br />
has been visited; this cannot happen with superior functions<br />
As a consequence the approach of Algorithm 1 would incur<br />
into cost<br />
O(|N| log |N| + W |H |)<br />
where W = # of values of domain (possible values of measure)
Note that in this case convergence is achieved after one scan of<br />
cycles (this is true for all measures based on WSUP functions)<br />
The next algorithm exploits this fact in order to overcome the<br />
difficulty <strong>and</strong> obtain better performance (same as Algorithm 1).<br />
Measures for which convergence is achieved after repeated visits<br />
of cycles can also be found <strong>and</strong> we also saw an example<br />
(average) where convergence requires an unbounded number of<br />
scans of cycles.
Algorithm 2 - Let H = be a <strong>directed</strong><br />
hypergraph. Let µ be an inductively defined<br />
measure based on superior functions. Algorithm<br />
2 computes all single source shortest distances<br />
starting from source set S.<br />
1) Propagate reachability<br />
2) Perform Algorithm 1
Algorithm 2 computes all shortest distances from<br />
source set S in time O(|H| log |N| + |H |).<br />
Again cost can be reduced to O(|N| log |N| + |H |)<br />
by making use of Fibonacci heaps for<br />
implementing the priority queue.<br />
The algorithm can be extended to deal with<br />
maximization problems for measures based on<br />
weakly inferior functions.
Exercises<br />
Prove that the following problems are NP-hard:<br />
• hyperpath with minimum size<br />
• hyperpath with minimum source area<br />
• hyperpath with minimum number of source<br />
sets
Essential references<br />
• Ausiello, D’Atri, Sacca’, Minimal representation of <strong>directed</strong><br />
<strong>hypergraphs</strong>, SIAM on Comp., 1986<br />
• Ausiello, Italiano, Online <strong>algorithms</strong> for polynomially solvable<br />
satisfiability problems, J. of Logic Prog., 1991<br />
• Gallo, Longo, Nguyen, Pallottino, Directed <strong>hypergraphs</strong> <strong>and</strong><br />
<strong>applications</strong>, Discrete Applied Math., 1993<br />
• Ramalingam, Reps, An incremental algorithm for a generalization of<br />
the shortest path problem, J. of Algorithms, 1996<br />
• Esparza, Kiefer, Luttenberger, Solving monotone polynomial<br />
equations, 5° IFIP Conf. on Theor. Comp. Sc., 2008<br />
• Ausiello, Italiano, Laura, Nanni, Sarracco, Classification <strong>and</strong> traversal<br />
algorithmic techniques for optimization problems on <strong>directed</strong><br />
hyperpaths, Tech. Rep. DIS, Sapienza University of Rome 2011