Constant delay enumeration for FO queries over databases with local bounded expansion Luc Segoufin 1 Alexandre Vigny 2 1 ENS Ulm, Paris 2 Université Paris Diderot, Paris November 16, 2017 Alexandre Vigny Enumeration & local-bounded expansion November 16, 2017 1 / 12
Introduction Query q small Database D huge Compute q ( D ) gigantic Examples : query q solutions q ( D ) database D 1 2 3 { (1,2) (1,3) (1,4) q ( x , y ) : = ∃ z ( B ( x ) ∧ (1,6) (1,7) ··· E ( x , z ) ∧ ¬ E ( y , z )) (3,1) (3,2) (3,4) 4 5 6 (3,6) (3,7) ··· ··· } 7 8 9 Alexandre Vigny Enumeration & local-bounded expansion November 16, 2017 2 / 12
Enumeration Input : � D � : = n & � q � : = k (computation with RAM) Goal : output solutions one by one (no repetition) STEP 1 : Preprocessing Prepare the enumeration : Database D − → Index I Preprocessing time : f ( k ) · n ❀ O ( n ) STEP 2 : Enumeration Enumerate the solutions : Index I − → x 1 , x 2 , x 3 , x 4 , ··· Delay : O ( f ( k )) ❀ O (1) Constant delay enumeration after linear preprocessing Alexandre Vigny Enumeration & local-bounded expansion November 16, 2017 3 / 12
Example 1 Input : - Database D : = 〈 { 1 , ··· , n } ; E 〉 � D � = | E | ( E ⊆ D × D ) - Query q ( x , y ) : = ¬ E ( x , y ) D (1,1) (1,2) (1,6) . . . (2,3) . . . (i,j) (i,j+1) (i,j+3) . . . (n,n) Alexandre Vigny Enumeration & local-bounded expansion November 16, 2017 4 / 12
Example 1 Input : - Database D : = 〈 { 1 , ··· , n } ; E 〉 � D � = | E | ( E ⊆ D × D ) - Query q ( x , y ) : = ¬ E ( x , y ) D Index (1,1) (1,1) (1,2) (1,2) (1,3) (1,6) (1,6) . . . . . . (2,3) (2,3) (2,4) . . . . . . (i,j) (i,j) (i,j+1) (i,j+1) (i,j+2) (i,j+3) (i,j+3) (k,l) . . . . . . (n,n) (n,n) NULL Alexandre Vigny Enumeration & local-bounded expansion November 16, 2017 4 / 12
Example 1 Input : - Database D : = 〈 { 1 , ··· , n } ; E 〉 � D � = | E | ( E ⊆ D × D ) - Query q ( x , y ) : = ¬ E ( x , y ) D Index Enum (1,1) (1,1) (1,1) (1,2) (1,2) (1,3) (1,3) (1,6) (1,6) (1,4) . . . . (1,5) . . (2,3) (2,3) (2,4) (1,6) . . . . (2,4) . . (i,j) (i,j) (2,5) (i,j+1) (i,j+1) (i,j+2) . . . (i,j+3) (i,j+3) (k,l) . . . . NULL . . (n,n) (n,n) NULL Alexandre Vigny Enumeration & local-bounded expansion November 16, 2017 4 / 12
Example 2 Input : - Database D : = 〈 { 1 , ··· , n } ; E 1 ; E 2 〉 � D � = | E 1 |+| E 2 | ( E i ⊆ D × D ) - Query q ( x , y ) : = ∃ z , E 1 ( x , z ) ∧ E 2 ( z , y ) Alexandre Vigny Enumeration & local-bounded expansion November 16, 2017 5 / 12
Example 2 Input : - Database D : = 〈 { 1 , ··· , n } ; E 1 ; E 2 〉 � D � = | E 1 |+| E 2 | ( E i ⊆ D × D ) - Query q ( x , y ) : = ∃ z , E 1 ( x , z ) ∧ E 2 ( z , y ) B : Adjacency matrix of E 2 E 2 (1 , 1) . . . E 2 (1 , y ) . . . E 2 (1 , n ) . . . ... ... . . . . . . E 2 ( z, 1) . . . E 2 ( z, y ) . . . E 2 ( z, n ) . ... . ... . . . . . . . E 2 ( n, 1) . . . E 2 ( n, y ) . . . E 2 ( n, n ) E 1 (1 , 1) . . . E 1 (1 , i ) . . . E 1 (1 , n ) q (1 , 1) . . . q (1 , y ) . . . q (1 , n ) . ... . ... . . . . . ... . ... . . . . . . . . . . E 1 ( x, 1) . . . E 1 ( x, z ) . . . E 1 ( x, n ) q ( x, 1) . . . q ( x, y ) . . . q ( x, n ) . . . . . . ... ... ... ... . . . . . . . . . . . . q ( n, 1) . . . q ( n, y ) . . . q ( n, n ) E 1 ( n, 1) . . . E 1 ( n, z ) . . . E 1 ( n, n ) C : Result matrix A : Adjacency matrix of E 1 Alexandre Vigny Enumeration & local-bounded expansion November 16, 2017 5 / 12
Example 2 Input : - Database D : = 〈 { 1 , ··· , n } ; E 1 ; E 2 〉 � D � = | E 1 |+| E 2 | ( E i ⊆ D × D ) - Query q ( x , y ) : = ∃ z , E 1 ( x , z ) ∧ E 2 ( z , y ) B : Adjacency matrix of E 2 E 2 (1 , 1) . . . E 2 (1 , y ) . . . E 2 (1 , n ) . . . ... ... . . . . . . E 2 ( z, 1) . . . E 2 ( z, y ) . . . E 2 ( z, n ) Compute the set of solutions . ... . ... . . . . . . . = E 2 ( n, 1) . . . E 2 ( n, y ) . . . E 2 ( n, n ) boolean matrix multiplication E 1 (1 , 1) . . . E 1 (1 , i ) . . . E 1 (1 , n ) q (1 , 1) . . . q (1 , y ) . . . q (1 , n ) . ... . ... . . . . . ... . ... . . . . . . . . . . E 1 ( x, 1) . . . E 1 ( x, z ) . . . E 1 ( x, n ) q ( x, 1) . . . q ( x, y ) . . . q ( x, n ) . . . . . . ... ... ... ... . . . . . . . . . . . . q ( n, 1) . . . q ( n, y ) . . . q ( n, n ) E 1 ( n, 1) . . . E 1 ( n, z ) . . . E 1 ( n, n ) C : Result matrix A : Adjacency matrix of E 1 Alexandre Vigny Enumeration & local-bounded expansion November 16, 2017 5 / 12
Example 2 Input : - Database D : = 〈 { 1 , ··· , n } ; E 1 ; E 2 〉 ( E i ⊆ D × D ) � D � = | E 1 |+| E 2 | - Query q ( x , y ) : = ∃ z , E 1 ( x , z ) ∧ E 2 ( z , y ) B : Adjacency matrix of E 2 � Linear preprocessing : O ( n 2 ) E 2 (1 , 1) . . . E 2 (1 , y ) . . . E 2 (1 , n ) . ... . ... . . . . � Number of solutions : O ( n 2 ) . . . E 2 ( z, 1) . . . E 2 ( z, y ) . . . E 2 ( z, n ) � Algorithm for the boolean . . . ... ... . . . . . . matrix multiplication in O ( n 2 ) E 2 ( n, 1) . . . E 2 ( n, y ) . . . E 2 ( n, n ) � Conjecture : E 1 (1 , 1) . . . E 1 (1 , i ) . . . E 1 (1 , n ) q (1 , 1) . . . q (1 , y ) . . . q (1 , n ) "There are no algorithm for the . ... . ... . . . . . . . ... ... . . . . . . boolean matrix multiplication . . . E 1 ( x, 1) . . . E 1 ( x, z ) . . . E 1 ( x, n ) q ( x, 1) . . . q ( x, y ) . . . q ( x, n ) working in time O ( n 2 )." . ... . ... . . ... . ... . . . . . . . . . . . . . q ( n, 1) . . . q ( n, y ) . . . q ( n, n ) E 1 ( n, 1) . . . E 1 ( n, z ) . . . E 1 ( n, n ) C : Result matrix A : Adjacency matrix of E 1 Alexandre Vigny Enumeration & local-bounded expansion November 16, 2017 5 / 12
Example 2 Input : - Database D : = 〈 { 1 , ··· , n } ; E 1 ; E 2 〉 � D � = | E 1 |+| E 2 | ( E i ⊆ D × D ) - Query q ( x , y ) : = ∃ z , E 1 ( x , z ) ∧ E 2 ( z , y ) This query cannot be enumerated with constant delay 1 1. Unless there is a breakthrough with the boolean matrix multiplication. Alexandre Vigny Enumeration & local-bounded expansion November 16, 2017 5 / 12
Example 2 Input : - Database D : = 〈 { 1 , ··· , n } ; E 1 ; E 2 〉 � D � = | E 1 |+| E 2 | ( E i ⊆ D × D ) - Query q ( x , y ) : = ∃ z , E 1 ( x , z ) ∧ E 2 ( z , y ) This query cannot be enumerated with constant delay 1 We need to put restrictions on queries and/or databases. 1. Unless there is a breakthrough with the boolean matrix multiplication. Alexandre Vigny Enumeration & local-bounded expansion November 16, 2017 5 / 12
Recommend
More recommend