Grammar-Based Graph Compression Fabian Peternek October 25, 2016
Use of Grammar-Based Compression: Speed-up Algorithms Some queries can be answered in polynomial time on a grammar, e.g., Strings ( O ( n 2 log ∗ n ) , see also [Lohrey, 2012]) ◮ Equality ◮ NFA membership ( O ( n |A| 3 ) , [Plandowski and Rytter, 1999]) ( O ( n 2 log n ) , [Jez, 2012]) ◮ Pattern matching Trees ◮ Equality (PTIME, [Busatto, Maneth, Lohrey, 2008]) ◮ TA membership (PTIME, [Lohrey, Maneth, Schmidt-Schauß, 2012]) ◮ Isomorphism (PTIME, [Lohrey, Maneth, P, 2015]) Speed-up proportional to compression ratio F. Peternek Grammar-Based Graph Compression October 25, 2016 2 / 28
Use of Grammar-Based Compression: Speed-up Algorithms Some queries can be answered in polynomial time on a grammar, e.g., Strings ( O ( n 2 log ∗ n ) , see also [Lohrey, 2012]) ◮ Equality ◮ NFA membership ( O ( n |A| 3 ) , [Plandowski and Rytter, 1999]) ( O ( n 2 log n ) , [Jez, 2012]) ◮ Pattern matching Trees ◮ Equality (PTIME, [Busatto, Maneth, Lohrey, 2008]) ◮ TA membership (PTIME, [Lohrey, Maneth, Schmidt-Schauß, 2012]) ◮ Isomorphism (PTIME, [Lohrey, Maneth, P, 2015]) Speed-up proportional to compression ratio For graph grammars? ◮ Reachability ( O ( | G | ) , [Maneth and P, 2016]) ◮ Regular Path Queries ( O ( | G ||A| ) , [Maneth and P, 2016]) ◮ Others? F. Peternek Grammar-Based Graph Compression October 25, 2016 2 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings abcabcabc F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings a b c a b c c b a F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings a b c a b c c b a F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings a b c Digrams: a a b 1 times b c c b a F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings a b c Digrams: a a b 1 times b c b 1 times c c b a F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings a b c Digrams: a a b 1 times b c b 1 times c a 1 times c c b a F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings a b c Digrams: a a b 2 times b c b 1 times c a 1 times c c b a F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings a b c Digrams: a a b 2 times b c b 2 times c a 1 times c c b a F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings a b c Digrams: a a b 2 times b c b 2 times c a 2 times c c b a F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings a b c Digrams: a a b 3 times b c b 2 times c a 2 times c c b a F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings a b c Digrams: a a b 3 times b c b 3 times c a 2 times c c b a F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings a b c Digrams: a a b 3 times b c b 3 times c a 2 times c c b a F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings A c Digrams: a a b 2 times b c b 2 times c a 2 times c c b a A c 1 times a b A → F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings A c Digrams: a b 1 times A b c 1 times c a 1 times c c b a A c 2 times c A 1 times a b A → F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings A c A c c A A c 3 times c A 2 times a b A → F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings A c A c c A A c 3 times c A 2 times a b A → 1 2 F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings B A c c A A c 2 times c A 1 times a b A → 1 2 a b B → 1 2 F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings B B c A A c 1 times a b A → 1 2 a b B → 1 2 F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
Computing Small Grammars Finding a smallest grammar is NP-complete [Charikar et al., 2005]. ⇒ Approximations One Approximation: RePair compression for Strings B B B Size: a b A → Original string: 9 edges, 10 nodes 1 2 Grammar: 7 edges, 10 nodes a b B → 1 2 F. Peternek Grammar-Based Graph Compression October 25, 2016 3 / 28
RePair for Graphs Goal: Extend RePair to graphs with hyperedge replacement graph grammars [Habel, 1992] b a c c b a a c b F. Peternek Grammar-Based Graph Compression October 25, 2016 4 / 28
RePair for Graphs Goal: Extend RePair to graphs with hyperedge replacement graph grammars [Habel, 1992] b a b : 3 times a c 1 2 c b a a c b F. Peternek Grammar-Based Graph Compression October 25, 2016 4 / 28
RePair for Graphs Goal: Extend RePair to graphs with hyperedge replacement graph grammars [Habel, 1992] b a b : 3 times a c 1 2 b c c b a : 3 times 1 2 a c b F. Peternek Grammar-Based Graph Compression October 25, 2016 4 / 28
RePair for Graphs Goal: Extend RePair to graphs with hyperedge replacement graph grammars [Habel, 1992] b a b : 3 times a c 1 2 b c c b a : 3 times 1 2 a c c a b : 2 times 1 2 Not 4 – overlapping! F. Peternek Grammar-Based Graph Compression October 25, 2016 4 / 28
RePair for Graphs Goal: Extend RePair to graphs with hyperedge replacement graph grammars [Habel, 1992] A c c A A c a b A → 1 2 F. Peternek Grammar-Based Graph Compression October 25, 2016 4 / 28
RePair for Graphs Goal: Extend RePair to graphs with hyperedge replacement graph grammars [Habel, 1992] A c : 3 times A c 1 3 c A c A : 2 times 1 3 A c a b A → 1 2 F. Peternek Grammar-Based Graph Compression October 25, 2016 4 / 28
RePair for Graphs Goal: Extend RePair to graphs with hyperedge replacement graph grammars [Habel, 1992] B B B a b A → Size of original graph: 17 1 2 Size of grammar: 15 A c B → 1 2 F. Peternek Grammar-Based Graph Compression October 25, 2016 4 / 28
What if all nodes have a degree > 2? F. Peternek Grammar-Based Graph Compression October 25, 2016 5 / 28
What if all nodes have a degree > 2? F. Peternek Grammar-Based Graph Compression October 25, 2016 5 / 28
Recommend
More recommend