directed hypergraphs algorithms and applications .fr

ALGORITHMS AND APPLICATIONS. Giorgio Ausiello ... Applications of directed hypergraphs. • Basic definitions ... Operations research (Gallo et al. 1989).
2MB taille 156 téléchargements 337 vues
DIRECTED HYPERGRAPHS ALGORITHMS AND APPLICATIONS Giorgio Ausiello Joint work with L. Laura, G.F. Italiano, U. Nanni September 2011

HYPERGRAPHS IN COMPUTER SCIENCE

Generalization of graphs Typically used to model sets and relational systems

DIRECTED HYPERGRAPHS IN COMPUTER SCIENCE

Generalization of digraphs Typically used to model functional (implicational) systems A, B, C-->D D --> E E, F-->G

OUTLINE OF LECTURES • • • • •

Applications of directed hypergraphs Basic definitions Reachability Transitive closure and transitive reduction Shortest hyperpaths

1. APPLICATIONS OF DIRECTED HYPERGRAPHS Propositional Horn formulae (propositional formulae in CNF with at most one positive literal per clause) A∧B∧C --> D D --> E E∧F --> G (¬A ∨ ¬B ∨ ¬C ∨ D) ∧ (¬D ∨ E) ∧ (¬E ∨ ¬F ∨ G)

Functional dependency in databases B C --> E E --> F C --> D F D H --> G F --> B The attributes B and C are key for E and for F

And-or graphs

Solving problem F requires either the solution of problems A and B or the solution of problem G.

Very long history in several domains of computer science: Formal languages (Knuth 1977) Artificial intelligence (Boley 1977, Torres and Araoz 1988) Databases (Ausiello et al. 1983) Operations research (Gallo et al. 1989) Logic programming (Gallo, Rago 1990, Ausiello, Italiano 1991) Expert systems (Ausiello, Giaccio 1997, Ramaswamy et al. 1997) Model checking (Smolka 1998) Routing protocols (Thakur, Tripathi 2004) Semantic web (Martinez, Vidal 2007) Concurrency ( Feuerstein et al. 2010)

2. BASIC DEFINITIONS • A directed hypergraph is a pair H = where N is the set of nodes and H ⊆ P (N) x N is the set of hyperarcs. • In a hyperarc h = (S, t) S is always a non empty set and is called the source set (tail) while t is called the target node (head). • For sake of simplicity of notation the hyperarc ({A, B, C}, D) will always be denoted (ABC, D).

Hypergraph measures Number (n) of nodes Number (m) of hyperarcs Number (s) of (distinct) source sets Source area (a): sum of cardinalities of source sets • Size of a hypergraph: length of the overall representation (e.g. by means of adjacency lists) = source area + number of hyperarcs The size of a hypergraph H is also denoted |H |. • • • •

Adjacency list representation of the hypergraph in Figure: A-->B AC --> ED BE --> F DFH-->G n = 8, m = 5, s =4, a = 8, size = 13

Hyperpath Given a hypergraph H = , a non empty set of nodes X and a node y, we say that there is a hyperpath from X to y (denoted ) if either – y ∈ X (extended reflexivity) – there exists a hyperarc and hyperpaths for any zi ∈ Z (extended transitivity).

The structure of a hyperpath can be made more explicit by making use of its ‘unfolded’ (tree) representation.

Funny things happen in directed hypergraphs: • a hyperpath is not a sub-hypergraph (due to extended reflexivity) • a hyperpath can exploit the same (hyper)arc several times (this happens in graphs only in the case that a path forms a cycle) • an unfolded hyperpath can be exponentially larger than the folded hyperpath (this does not happen in graphs)

Cycles in hypergraphs Intuitively, we have a cycle in a directed hypergraph whenever there exists a non-empty hyperpath leading from a node s (or a set of nodes S) to itself. A hypergraph containing a cycle is called cyclic.

A cycle (in red) in an hypergraph.

A cyclic structure (in blue) that is NOT a cycle in an hypergraph.

A cycle leading from a set of nodes S to itself

Note: no cycle leading from a single node to itself

Graph representation of directed hypergraphs.

Graph reduction: given a hypergraph H = , we construct a digraph G = where for any hyperarc h = (S, t) and for any node zi∈S, A contains the arc (zi, t).

FD-graph

FD-graph: given a directed hypergraph H = , we construct a digraph G = where N’ contains all distinct source sets in H and A and B are two sets of arcs: respectively the full arcs (for any hyperarc h = (S, t) A contains the full arc from the source set S to t) and the dotted arcs (for any non singleton source set S and any node zi∈S, B contains the dotted arc (S, zi).

3. REACHABILITY IN DIRECTED HYPERGRAPHS • REACHABILITY IN DIGRAPHS: Given a digraph G = , given two nodes s and t in N we say that t is reachable from s if there exists a directed path from s to t. Reachability in digraphs is NL (non deterministic log-space) -complete. • REACHABILITY IN DIRECTED HYPERGRAPHS: Given a directed hypergraph H = , given two nodes s and t in N (resp. one set S and a node t) we say that t is reachable from s (resp. S) if there exists a hyperpath from s (resp. S) to t. Reachability in directed hypergraphs is P-complete.

A few examples of P-complete problems: • Circuit Value Problem: given a Boolean circuit, the input to the circuit and one gate in the circuit decide whether the output of the gate is 0 or 1. • Context Free Grammar Membership: given a CF grammar and a string decide whether that string can be generated by the grammar. • Linear Programming: given a linear function, a system of linear inequality constraints and a value, decide whether the maximum value of the function in the polytope that satisfies the constraints is above the given value.

Let us show that REACHABILITY IN DIRECTED HYPERGRAPHS is P-complete. 1) REACHABILITY IN DIRECTED HYPERGRAPHS is in P: a simple breadth first visit in H allows to decide reachability in time O(|H |). 2) REACHABILITY IN DIRECTED HYPERGRAPHS is complete in P.

Consider the following problem: SOLVABLE PATH SYSTEM: Given a finite set X, a set R ⊆ X x X x X and two elements s, t ∈ X, decide whether t is contained in a set A of elements of X reachable from s, where A is defined as follows: s ∈ A and if (x, y, z) ∈ R and both x and y belong to A then also z belongs to A.

SOLVABLE PATH SYSTEM is P-complete (Cook 1974) It is immediate to show that SOLVABLE PATH SYSTEM can be log-space reduced to REACHABILITY IN DIRECTED HYPERGRAPH. Given an instance of SOLVABLE PATH SYSTEM just consider the directed hypergraph H where the set of nodes is X and for any triple in R, (zi, zj, zl) (resp. (zi, zi, zl)), H contains the hyperarc (zi zj, zl) (resp. the hyperarc (zi, zl)). Clearly a node zt is reachable from a node zs in H iff t is reachable from s in the solvable path system problem.

This also yields a simple proof that HORN-SATISFIABILITY is P-complete (the standard proof requires a variation of Cook’s Theorem). Let us consider the following instance of REACHABILITY IN DIRECTED HYPERGRAPH: a directed hypergraph H = and two nodes in N, s and t. We can construct a Horn formula F whose variables correspond to the nodes in N and whose clauses are defined as follows: for any hyperarc (vi1…vik , z) in H F will contain the clause (vi1∧ …∧ vik -> z), besides F will contain the following clauses: s and ¬t. It is easy to observe that the formula F is satisfiable iff in H the node t is not reachable from the node s.

A satisfiable Horn formula

A NON satisfiable Horn formula

Remarks. Satisfiability of a Horn formula can be tested and maintained by means of dynamic algorithms for directed hypergraphs (extension of dynamic graph algorithms) – Operations: INSERT-CLAUSE, TEST-SAT All clauses can be dynamically inserted in time O(|H |) while satisfiability can be tested in time O(1) (A., Italiano 1991)

As a byproduct we can efficiently: • compute on-line the minimum model of the formula, • test consistency of logical hypotheses (what if variable V is set to true?) • perform consistency recovery (A., Franciosa, Frigioni 2005)

A minimum model of a formula

Consistency test: if we put I to True, the formula remains consistent

Consistency test: if we put I and D to True, the formula becomes inconsistent

Exercises 1) Define suitable notions of cut and flow in directed hypergraphs 2) Analyze the complexity of the MIN-CUT problem in directed hypergraphs. 3) Discuss the MIN-CUT – MAX-FLOW relation in directed hypergraphs. 4) Provide logical applications of the MIN-CUT problem.