├── Query ├── Q21_key.txt ├── Q5_key.txt ├── Q7_key.txt ├── Q8_key.txt ├── one_path_key.txt ├── rectangle_key.txt ├── so.txt ├── triangle_key.txt ├── two_path_key.txt ├── Q10_key.txt ├── Q11_key.txt ├── Q12_key.txt ├── Q18_key.txt ├── Q20_key.txt ├── Q3_key.txt ├── sc.txt ├── Q12.txt ├── Q10.txt ├── Q18.txt ├── one_path.txt ├── Q11.txt ├── Q20.txt ├── Q3.txt ├── two_path.txt ├── Q21.txt ├── triangle.txt ├── rectangle.txt ├── Q7.txt ├── Q5.txt └── Q8.txt ├── TestSystem ├── Q11_key.txt ├── Q12_key.txt ├── Q18_key.txt ├── Q20_key.txt ├── Q3_key.txt ├── Q11_private_relation.txt ├── Q12_private_relation.txt ├── Q18_private_relation.txt ├── Q20_private_relation.txt ├── Q3_private_relation.txt ├── Q21_key.txt ├── Q5_key.txt ├── Q7_key.txt ├── Q8_key.txt ├── Q21_private_relation.txt ├── Q5_private_relation.txt ├── Q7_private_relation.txt ├── Q8_private_relation.txt ├── Q12.txt ├── Q18.txt ├── Q11.txt ├── Q21.txt ├── Q20.txt ├── Q3.txt ├── Q5.txt ├── Q7.txt └── Q8.txt ├── Result ├── Graph │ ├── R2TOld_rectangle_Amazon1.txt │ ├── R2TOld_rectangle_Amazon2.txt │ ├── R2TOld_rectangle_Deezer.txt │ ├── R2TOld_rectangle_RoadnetCA.txt │ ├── R2TOld_rectangle_RoadnetPA.txt │ ├── LP_All_Tau_one_path_RoadnetCA.txt │ ├── LP_All_Tau_one_path_RoadnetPA.txt │ ├── NT_triangle_Amazon2.txt │ ├── NT_triangle_RoadnetPA.txt │ ├── SDE_one_path_Deezer.txt │ ├── SDE_triangle_Amazon1.txt │ ├── SDE_triangle_Deezer.txt │ ├── SDE_triangle_RoadnetPA.txt │ ├── NT_one_path_Amazon1.txt │ ├── NT_one_path_Amazon2.txt │ ├── NT_one_path_Deezer.txt │ ├── NT_rectangle_RoadnetCA.txt │ ├── NT_triangle_Amazon1.txt │ ├── NT_triangle_Deezer.txt │ ├── NT_triangle_RoadnetCA.txt │ ├── SDE_one_path_Amazon1.txt │ ├── SDE_one_path_Amazon2.txt │ ├── SDE_triangle_RoadnetCA.txt │ ├── NT_rectangle_Amazon1.txt │ ├── NT_two_path_Amazon2.txt │ ├── NT_two_path_RoadnetCA.txt │ ├── SDE_rectangle_RoadnetCA.txt │ ├── SDE_triangle_Amazon2.txt │ ├── LP_triangle_Amazon2.txt │ ├── NT_one_path_RoadnetCA.txt │ ├── NT_one_path_RoadnetPA.txt │ ├── NT_rectangle_Amazon2.txt │ ├── NT_rectangle_RoadnetPA.txt │ ├── NT_two_path_Amazon1.txt │ ├── R2T_one_path_Deezer.txt │ ├── RM_triangle_RoadnetPA.txt │ ├── SDE_rectangle_Amazon1.txt │ ├── SDE_rectangle_Amazon2.txt │ ├── SDE_rectangle_RoadnetPA.txt │ ├── SDE_two_path_Amazon1.txt │ ├── SDE_two_path_Deezer.txt │ ├── SDE_two_path_RoadnetCA.txt │ ├── LP_one_path_Amazon2.txt │ ├── LP_rectangle_RoadnetCA.txt │ ├── LP_triangle_RoadnetPA.txt │ ├── NT_rectangle_Deezer.txt │ ├── NT_two_path_RoadnetPA.txt │ ├── R2T_triangle_Amazon2.txt │ ├── R2T_triangle_RoadnetPA.txt │ ├── RM_triangle_RoadnetCA.txt │ ├── SDE_one_path_RoadnetCA.txt │ ├── SDE_one_path_RoadnetPA.txt │ ├── SDE_rectangle_Deezer.txt │ ├── SDE_two_path_Amazon2.txt │ ├── SDE_two_path_RoadnetPA.txt │ ├── LP_one_path_Amazon1.txt │ ├── LP_one_path_Deezer.txt │ ├── LP_rectangle_Amazon1.txt │ ├── LP_rectangle_RoadnetPA.txt │ ├── LP_triangle_Amazon1.txt │ ├── LP_triangle_Deezer.txt │ ├── LP_triangle_RoadnetCA.txt │ ├── LP_two_path_Deezer.txt │ ├── LP_two_path_RoadnetCA.txt │ ├── NT_two_path_Deezer.txt │ ├── R2T_one_path_Amazon1.txt │ ├── R2T_one_path_Amazon2.txt │ ├── R2T_rectangle_RoadnetCA.txt │ ├── R2T_rectangle_RoadnetPA.txt │ ├── R2T_triangle_Amazon1.txt │ ├── R2T_triangle_Deezer.txt │ ├── R2T_triangle_RoadnetCA.txt │ ├── RM_rectangle_RoadnetPA.txt │ ├── LP_one_path_RoadnetCA.txt │ ├── LP_one_path_RoadnetPA.txt │ ├── LP_two_path_Amazon1.txt │ ├── R2T_one_path_RoadnetPA.txt │ ├── R2T_rectangle_Amazon1.txt │ ├── R2T_rectangle_Amazon2.txt │ ├── R2T_two_path_Amazon2.txt │ ├── R2T_two_path_RoadnetPA.txt │ ├── LP_rectangle_Amazon2.txt │ ├── LP_rectangle_Deezer.txt │ ├── LP_two_path_Amazon2.txt │ ├── LP_two_path_RoadnetPA.txt │ ├── R2T_one_path_RoadnetCA.txt │ ├── R2T_two_path_Amazon1.txt │ ├── R2T_two_path_RoadnetCA.txt │ ├── R2T_rectangle_Deezer.txt │ ├── R2T_two_path_Deezer.txt │ ├── LP_All_Tau_triangle_RoadnetPA.txt │ ├── LP_All_Tau_triangle_RoadnetCA.txt │ ├── LP_All_Tau_two_path_RoadnetCA.txt │ ├── LP_All_Tau_two_path_RoadnetPA.txt │ ├── QueryTimeGraph.txt │ ├── ExtractInfoTimeGraph.txt │ ├── LP_All_Tau_one_path_Amazon1.txt │ ├── LP_All_Tau_one_path_Amazon2.txt │ ├── LP_All_Tau_one_path_Deezer.txt │ ├── LP_Diff_Tau.txt │ ├── LP_All_Tau_rectangle_RoadnetCA.txt │ ├── LP_All_Tau_rectangle_RoadnetPA.txt │ ├── LP_All_Tau_two_path_Deezer.txt │ ├── LP_All_Tau_two_path_Amazon1.txt │ ├── LP_All_Tau_triangle_Amazon1.txt │ ├── LP_All_Tau_triangle_Amazon2.txt │ ├── LP_All_Tau_triangle_Deezer.txt │ ├── LP_All_Tau_two_path_Amazon2.txt │ ├── LP_All_Tau_rectangle_Deezer.txt │ ├── LP_All_Tau_rectangle_Amazon1.txt │ └── LP_All_Tau_rectangle_Amazon2.txt └── TPCH │ ├── LS_Q12_GS.txt │ ├── LS_Q20_GS.txt │ ├── R2T_Q3_GS.txt │ ├── LS_Q3_GS.txt │ ├── R2T_Q12_GS.txt │ ├── R2T_Q20_GS.txt │ ├── LS_Q12_Scalability.txt │ ├── LS_Q20_Scalability.txt │ ├── LS_Q3_Scalability.txt │ ├── R2T_Q3_Scalability.txt │ ├── R2T_Q12_Scalability.txt │ ├── R2T_Q20_Scalability.txt │ ├── LS_Q12.txt │ ├── LS_Q20.txt │ ├── LS_Q3.txt │ ├── R2T_Q21.txt │ ├── R2T_Q5.txt │ ├── R2T_Q12.txt │ ├── R2T_Q20.txt │ ├── R2T_Q3.txt │ ├── R2T_Q10.txt │ ├── R2T_Q8.txt │ ├── R2T_Q18.txt │ ├── R2T_Q7.txt │ ├── R2T_Q11.txt │ ├── ExtractInfoTimeTPCH.txt │ └── QueryTimeTPCH.txt ├── Figure ├── Eps.pdf ├── GS.pdf └── Scalability.pdf ├── Data └── .gitignore ├── Temp └── .gitignore ├── Information └── .gitignore ├── Script ├── CollectResultsLSGS.py ├── CollectExtractInfoTimeGraph.py ├── CollectResultsLS.py ├── CollectResultsTPCHGS.py ├── CollectResultsLSScalability.py ├── CollectExtractInfoTimeTPCH.py ├── CollectQueryTimeTPCH.py ├── CollectResultsRM.py ├── ProcessGraphData.py ├── CollectQueryTimeGraph.py ├── CollectResultsLPDifferentTau.py ├── System.py ├── CollectResultsLP.py ├── DrawFigureGS.py ├── CollectResultsNT.py ├── CollectResultsGraph.py ├── CollectResultsTPCH.py ├── CollectResultsTPCHScalability.py ├── CollectResultsLPAllTau.py ├── CollectResultsR2TOld.py ├── DrawFigureEps.py └── CollectResultsSDE.py └── Code ├── LS.py ├── R2TSJF.py ├── NT.py ├── R2TOld.py ├── ExtractInfo.py └── SystemExtractInfo.py /Query/Q21_key.txt: -------------------------------------------------------------------------------- 1 | i_id 2 | -------------------------------------------------------------------------------- /Query/Q5_key.txt: -------------------------------------------------------------------------------- 1 | i_id 2 | -------------------------------------------------------------------------------- /Query/Q7_key.txt: -------------------------------------------------------------------------------- 1 | i_id 2 | -------------------------------------------------------------------------------- /Query/Q8_key.txt: -------------------------------------------------------------------------------- 1 | i_id 2 | -------------------------------------------------------------------------------- /Query/one_path_key.txt: -------------------------------------------------------------------------------- 1 | id -------------------------------------------------------------------------------- /Query/rectangle_key.txt: -------------------------------------------------------------------------------- 1 | id -------------------------------------------------------------------------------- /Query/so.txt: -------------------------------------------------------------------------------- 1 | supplier orders -------------------------------------------------------------------------------- /Query/triangle_key.txt: -------------------------------------------------------------------------------- 1 | id -------------------------------------------------------------------------------- /Query/two_path_key.txt: -------------------------------------------------------------------------------- 1 | id -------------------------------------------------------------------------------- /Query/Q10_key.txt: -------------------------------------------------------------------------------- 1 | c_custkey 2 | -------------------------------------------------------------------------------- /Query/Q11_key.txt: -------------------------------------------------------------------------------- 1 | s_suppkey 2 | -------------------------------------------------------------------------------- /Query/Q12_key.txt: -------------------------------------------------------------------------------- 1 | o_orderkey 2 | -------------------------------------------------------------------------------- /Query/Q18_key.txt: -------------------------------------------------------------------------------- 1 | c_custkey 2 | -------------------------------------------------------------------------------- /Query/Q20_key.txt: -------------------------------------------------------------------------------- 1 | s_suppkey 2 | -------------------------------------------------------------------------------- /Query/Q3_key.txt: -------------------------------------------------------------------------------- 1 | c_custkey 2 | -------------------------------------------------------------------------------- /Query/sc.txt: -------------------------------------------------------------------------------- 1 | supplier customer -------------------------------------------------------------------------------- /TestSystem/Q11_key.txt: -------------------------------------------------------------------------------- 1 | s_suppkey 2 | -------------------------------------------------------------------------------- /TestSystem/Q12_key.txt: -------------------------------------------------------------------------------- 1 | o_orderkey 2 | -------------------------------------------------------------------------------- /TestSystem/Q18_key.txt: -------------------------------------------------------------------------------- 1 | c_custkey 2 | -------------------------------------------------------------------------------- /TestSystem/Q20_key.txt: -------------------------------------------------------------------------------- 1 | s_suppkey 2 | -------------------------------------------------------------------------------- /TestSystem/Q3_key.txt: -------------------------------------------------------------------------------- 1 | C_CUSTKEY 2 | -------------------------------------------------------------------------------- /TestSystem/Q11_private_relation.txt: -------------------------------------------------------------------------------- 1 | supplier 2 | -------------------------------------------------------------------------------- /TestSystem/Q12_private_relation.txt: -------------------------------------------------------------------------------- 1 | orders 2 | -------------------------------------------------------------------------------- /TestSystem/Q18_private_relation.txt: -------------------------------------------------------------------------------- 1 | customer 2 | -------------------------------------------------------------------------------- /TestSystem/Q20_private_relation.txt: -------------------------------------------------------------------------------- 1 | supplier 2 | -------------------------------------------------------------------------------- /TestSystem/Q3_private_relation.txt: -------------------------------------------------------------------------------- 1 | customer 2 | -------------------------------------------------------------------------------- /TestSystem/Q21_key.txt: -------------------------------------------------------------------------------- 1 | s_suppkey 2 | o_orderkey 3 | -------------------------------------------------------------------------------- /TestSystem/Q5_key.txt: -------------------------------------------------------------------------------- 1 | C_CUSTKEY 2 | S_SUPPKEY 3 | -------------------------------------------------------------------------------- /TestSystem/Q7_key.txt: -------------------------------------------------------------------------------- 1 | C_CUSTKEY 2 | S_SUPPKEY 3 | -------------------------------------------------------------------------------- /TestSystem/Q8_key.txt: -------------------------------------------------------------------------------- 1 | C_CUSTKEY 2 | S_SUPPKEY 3 | -------------------------------------------------------------------------------- /TestSystem/Q21_private_relation.txt: -------------------------------------------------------------------------------- 1 | supplier 2 | orders 3 | -------------------------------------------------------------------------------- /TestSystem/Q5_private_relation.txt: -------------------------------------------------------------------------------- 1 | customer 2 | supplier 3 | -------------------------------------------------------------------------------- /TestSystem/Q7_private_relation.txt: -------------------------------------------------------------------------------- 1 | customer 2 | supplier 3 | -------------------------------------------------------------------------------- /TestSystem/Q8_private_relation.txt: -------------------------------------------------------------------------------- 1 | customer 2 | supplier 3 | -------------------------------------------------------------------------------- /Result/Graph/R2TOld_rectangle_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 0.8 511.92880125045775 2 | -------------------------------------------------------------------------------- /Result/Graph/R2TOld_rectangle_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 0.8 394.81340091228486 2 | -------------------------------------------------------------------------------- /Result/Graph/R2TOld_rectangle_Deezer.txt: -------------------------------------------------------------------------------- 1 | 0.8 28615.856352090836 2 | -------------------------------------------------------------------------------- /Result/Graph/R2TOld_rectangle_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.8 6.590886068344116 2 | -------------------------------------------------------------------------------- /Result/Graph/R2TOld_rectangle_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.8 7.430262184143066 2 | -------------------------------------------------------------------------------- /Figure/Eps.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hkustDB/Race-to-the-Top/HEAD/Figure/Eps.pdf -------------------------------------------------------------------------------- /Figure/GS.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hkustDB/Race-to-the-Top/HEAD/Figure/GS.pdf -------------------------------------------------------------------------------- /Query/Q12.txt: -------------------------------------------------------------------------------- 1 | Select count(*) from orders, lineitem where o_orderkey = l_orderkey; 2 | -------------------------------------------------------------------------------- /TestSystem/Q12.txt: -------------------------------------------------------------------------------- 1 | Select count(*) from orders, lineitem where o_orderkey = l_orderkey; 2 | -------------------------------------------------------------------------------- /Data/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /Figure/Scalability.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hkustDB/Race-to-the-Top/HEAD/Figure/Scalability.pdf -------------------------------------------------------------------------------- /Temp/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /Information/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /Query/Q10.txt: -------------------------------------------------------------------------------- 1 | Select count(*) from orders, customer, nation where c_custkey = o_custkey and c_nationkey = n_nationkey; 2 | -------------------------------------------------------------------------------- /Query/Q18.txt: -------------------------------------------------------------------------------- 1 | select sum(l_quantity) from customer, orders, lineitem where c_custkey = o_custkey and o_orderkey = l_orderkey; 2 | -------------------------------------------------------------------------------- /Query/one_path.txt: -------------------------------------------------------------------------------- 1 | select count(*) 2 | from node as r1, node as r2, edge 3 | where r1.id=edge.from_id and r2.id=edge.to_id and r1.iddate'1994-01-01'; 2 | -------------------------------------------------------------------------------- /Query/two_path.txt: -------------------------------------------------------------------------------- 1 | select count (*) 2 | from node as r1, node as r2, node as r3, edge as r4, edge as r5 3 | where r4.to_id = r5.from_id and r1.id = r4.from_id and r2.id = r5.from_id and r3.id = r5.to_id and r1.id < r3.id; -------------------------------------------------------------------------------- /TestSystem/Q3.txt: -------------------------------------------------------------------------------- 1 | Select count(*) from customer, orders, lineitem where orders.O_CUSTKEY=customer.C_CUSTKEY and lineitem.L_ORDERKEY=orders.O_ORDERKEY and o_orderdatedate'1994-01-01'; 2 | -------------------------------------------------------------------------------- /Query/Q21.txt: -------------------------------------------------------------------------------- 1 | select count(*) from ids as id1, ids as id2, nation, supplier, lineitem, orders where s_suppkey = l_suppkey and o_orderkey = l_orderkey and s_nationkey = n_nationkey and id1.i_id = supplier.s_id and id2.i_id = orders.o_id; 2 | -------------------------------------------------------------------------------- /Result/TPCH/LS_Q12_GS.txt: -------------------------------------------------------------------------------- 1 | 10000 158.90337922478406 2 | 100000 2475.637782272417 3 | 1000000 1157892.407393996 4 | 10000000 2775712.057617591 5 | 100000000 5354375.550768744 6 | 1000000000 8656244.82995841 7 | 10000000000 63706378.69606474 8 | 100000000000 958632314.8423711 9 | -------------------------------------------------------------------------------- /Result/TPCH/LS_Q20_GS.txt: -------------------------------------------------------------------------------- 1 | 10000 25439.838935033185 2 | 100000 53229.93213601069 3 | 1000000 997699.0513110383 4 | 10000000 3780580.219008595 5 | 100000000 4831899.4003935 6 | 1000000000 6318682.505809066 7 | 10000000000 77806554.41193952 8 | 100000000000 1560760531.6461751 9 | -------------------------------------------------------------------------------- /Result/TPCH/R2T_Q3_GS.txt: -------------------------------------------------------------------------------- 1 | 10000 4440.079519173752 2 | 100000 4727.831572707277 3 | 1000000 5870.058752632933 4 | 10000000 7150.792707060774 5 | 100000000 8103.77294245145 6 | 1000000000 11287.6982715424 7 | 10000000000 13483.606153614897 8 | 100000000000 13292.447721375307 9 | -------------------------------------------------------------------------------- /Result/TPCH/LS_Q3_GS.txt: -------------------------------------------------------------------------------- 1 | 10000 15979.937480995044 2 | 100000 135626.96324400624 3 | 1000000 1173720.3759340968 4 | 10000000 1972822.1703350917 5 | 100000000 2954476.1188778975 6 | 1000000000 5160404.473885906 7 | 10000000000 8623118.65601856 8 | 100000000000 133400950.62144409 9 | -------------------------------------------------------------------------------- /Result/TPCH/R2T_Q12_GS.txt: -------------------------------------------------------------------------------- 1 | 10000 703.8118174678335 2 | 100000 942.5512961479835 3 | 1000000 1129.881106897723 4 | 10000000 1471.4287250248406 5 | 100000000 1618.74169840198 6 | 1000000000 1910.1746857630399 7 | 10000000000 2042.4545827646118 8 | 100000000000 2230.157830950959 9 | -------------------------------------------------------------------------------- /Result/TPCH/R2T_Q20_GS.txt: -------------------------------------------------------------------------------- 1 | 10000 19485.96291950997 2 | 100000 27680.43546966075 3 | 1000000 39039.85436817724 4 | 10000000 47595.577929627616 5 | 100000000 45293.64005854322 6 | 1000000000 59714.181357583344 7 | 10000000000 67525.53816763358 8 | 100000000000 66749.86627066105 9 | -------------------------------------------------------------------------------- /Query/triangle.txt: -------------------------------------------------------------------------------- 1 | select count (*) 2 | from node as r1, node as r2, node as r3, edge as r4, edge as r5, edge as r6 3 | where r4.from_id = r6.to_id and r5.from_id = r4.to_id and r6.from_id = r5.to_id and r1.id = r4.from_id and r2.id = r5.from_id and r3.id = r6.from_id and r1.id=date'1995-01-01' and o_orderdate<=date'1996-12-31'; 2 | -------------------------------------------------------------------------------- /Query/Q7.txt: -------------------------------------------------------------------------------- 1 | select sum(l_extendedprice * (1 - l_discount)/1000) from ids as id1, ids as id2, nation as n1, nation as n2, customer, orders, lineitem, supplier where n1.N_NATIONKEY=customer.C_NATIONKEY and n2.N_NATIONKEY=supplier.S_NATIONKEY and customer.C_CUSTKEY=orders.O_CUSTKEY and orders.O_ORDERKEY=lineitem.L_ORDERKEY and lineitem.L_SUPPKEY=supplier.S_SUPPKEY and id1.i_id = supplier.s_id and id2.i_id = customer.c_id; 2 | -------------------------------------------------------------------------------- /Result/TPCH/R2T_Q12_Scalability.txt: -------------------------------------------------------------------------------- 1 | 0.125 750594.0 1297.4852493426297 1.0414337396621705 2 | 0.25 1499579.0 1214.4535915853921 2.0075610637664796 3 | 0.5 2999671.0 1282.2095624989208 4.119884586334228 4 | 1.0 6001215.0 1169.1848117522895 8.318329358100891 5 | 2.0 11997996.0 1297.5936547371869 16.569614028930665 6 | 4.0 23996604.0 1188.9735113146405 35.65525381565094 7 | 8.0 47989007.0 1419.871679705878 59.44808144569397 8 | -------------------------------------------------------------------------------- /Result/TPCH/R2T_Q20_Scalability.txt: -------------------------------------------------------------------------------- 1 | 0.125 750594.0 33221.61545691205 0.6440189838409424 2 | 0.25 1499579.0 37133.75534900181 1.2717601537704468 3 | 0.5 2999671.0 32705.332581245108 2.478180456161499 4 | 1.0 6001215.0 33589.311971865594 5.282681250572205 5 | 2.0 11997996.0 32569.67408406486 10.555577087402344 6 | 4.0 23996604.0 38951.95863945099 19.557253074645995 7 | 8.0 47989007.0 37416.094620101154 43.43330342769623 8 | -------------------------------------------------------------------------------- /Query/Q5.txt: -------------------------------------------------------------------------------- 1 | select count(*) from ids as id1, ids as id2, supplier, lineitem, orders, customer, nation, region where supplier.S_SUPPKEY=lineitem.L_SUPPKEY and lineitem.L_ORDERKEY=orders.O_ORDERKEY and orders.O_CUSTKEY=customer.C_CUSTKEY and customer.C_NATIONKEY=nation.N_NATIONKEY and nation.N_NATIONKEY=supplier.S_NATIONKEY and region.R_REGIONKEY=nation.N_REGIONKEY and id1.i_id = supplier.s_id and id2.i_id = customer.c_id; 2 | -------------------------------------------------------------------------------- /Result/TPCH/LS_Q12.txt: -------------------------------------------------------------------------------- 1 | 0.1 6001215 3222877.330997642 5.017851670583089 2 | 0.2 6001215 2976899.0661351765 5.4273516496022545 3 | 0.4 6001215 2177313.5268893815 5.518042055765788 4 | 0.8 6001215 976128.6957866313 5.232670760154724 5 | 1.6 6001215 360041.0998264806 5.293119970957438 6 | 3.2 6001215 5639.5933640473 5.46763018767039 7 | 6.4 6001215 1163.3113353582512 5.458240858713785 8 | 12.8 6001215 247.17127738577418 5.54108693599701 9 | -------------------------------------------------------------------------------- /Result/TPCH/LS_Q20.txt: -------------------------------------------------------------------------------- 1 | 0.1 6001215 3353691.630624278 4.916209109624227 2 | 0.2 6001215 2399637.8426566995 5.045037698745728 3 | 0.4 6001215 2278060.9478769787 4.982424306869507 4 | 0.8 6001215 924758.6322181218 4.87115794022878 5 | 1.6 6001215 871873.6585901841 5.096045192082723 6 | 3.2 6001215 341445.18495341256 5.2617009083429975 7 | 6.4 6001215 333443.71483857575 4.979856832822164 8 | 12.8 6001215 93940.10496941519 4.936385567982992 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_triangle_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 0.1 667129 6185538150.407379 41.09261941035589 2 | 0.2 667129 840764178.8174555 41.64649009068806 3 | 0.4 667129 96398710.5757314 41.09548311551413 4 | 0.8 667129 12835806.660512855 41.02083683570227 5 | 1.6 667129 1896666.646398091 40.807239566644036 6 | 3.2 667129 402747.4117509793 40.79112767537435 7 | 6.4 667129 275296.8435212615 40.74464816888174 8 | 12.8 667129 217954.02176316787 40.6219243868192 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_triangle_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 67150 1114346757.1449077 23.23983347217242 2 | 0.2 67150 440677361.79217476 23.22970278660456 3 | 0.4 67150 201329976.23946744 23.209121267000832 4 | 0.8 67150 73839271.28555305 23.305239675442376 5 | 1.6 67150 18159902.31547352 23.535832957426706 6 | 3.2 67150 3365081.318658432 23.292725090185805 7 | 6.4 67150 409219.3327209999 23.51921149889628 8 | 12.8 67150 43397.65727265142 23.381184832255045 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_one_path_Deezer.txt: -------------------------------------------------------------------------------- 1 | 0.1 846915 62136052.21081622 9870.971460706394 2 | 0.2 846915 30602691.023598805 9870.969802838963 3 | 0.4 846915 10473362.184548363 9870.969562834898 4 | 0.8 846915 4643715.552477953 9870.97041356246 5 | 1.6 846915 2324137.943885775 9870.972668487231 6 | 3.2 846915 1315794.7730766134 9870.968297695319 7 | 6.4 846915 474708.3408894767 9870.969968241852 8 | 12.8 846915 264416.57607853715 9870.969834462801 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_triangle_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 0.1 717719 9801297281.121729 4570.760841441155 2 | 0.2 717719 2374140904.230816 4570.755787327288 3 | 0.4 717719 674252819.5058283 4570.757331399918 4 | 0.8 717719 186799094.866162 4570.758234672546 5 | 1.6 717719 61581904.15477566 4570.75981969595 6 | 3.2 717719 20322548.309077088 4570.759488785266 7 | 6.4 717719 8859927.106856134 4570.7579221439355 8 | 12.8 717719 4021069.3510393896 4570.756246752739 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_triangle_Deezer.txt: -------------------------------------------------------------------------------- 1 | 0.1 794210 25617942370.827854 9876.836084724267 2 | 0.2 794210 7833305413.90829 9876.84096530517 3 | 0.4 794210 1823761283.484239 9876.8421560057 4 | 0.8 794210 534291951.66972286 9876.843499022329 5 | 1.6 794210 194005067.70129865 9876.837795861562 6 | 3.2 794210 65918317.93508715 9876.837763269743 7 | 6.4 794210 28362523.046210594 9876.84309326013 8 | 12.8 794210 12751396.850906704 9876.837537675698 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_triangle_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 67150 26196956.49840396 105.8955932219823 2 | 0.2 67150 13219318.748520702 105.90901652177175 3 | 0.4 67150 4834192.483286801 105.90236970384916 4 | 0.8 67150 2784895.9621520084 105.910607924064 5 | 1.6 67150 1571738.5870442423 105.90506995519003 6 | 3.2 67150 579020.3360296236 105.8959466477235 7 | 6.4 67150 231586.1464670912 105.8947506447633 8 | 12.8 67150 134659.9463205693 105.90315985282263 9 | -------------------------------------------------------------------------------- /Result/TPCH/LS_Q3.txt: -------------------------------------------------------------------------------- 1 | 0.1 2888656 1575413.7245565695 3.5274592796961466 2 | 0.2 2888656 1709214.806351129 3.320426257451375 3 | 0.4 2888656 925885.1823165874 3.655515996615092 4 | 0.8 2888656 1119894.007669705 3.3107372999191282 5 | 1.6 2888656 505841.12552645657 3.471125260988871 6 | 3.2 2888656 346853.3505188397 3.484043335914612 7 | 6.4 2888656 180098.20536714044 3.5913044532140095 8 | 12.8 2888656 50017.82555921161 3.7660412311553957 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_one_path_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 0.1 899792 115442766.9416008 29.11530498504639 2 | 0.2 899792 27348496.372487966 29.229944911003116 3 | 0.4 899792 5295413.520107333 29.134035325050355 4 | 0.8 899792 909753.0784934278 29.27972266674042 5 | 1.6 899792 310178.1395589661 29.25764561653137 6 | 3.2 899792 130176.96130618644 29.23000951528549 7 | 6.4 899792 138971.14718475664 29.26808874130249 8 | 12.8 899792 137959.19475748134 29.338488390445708 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_one_path_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 0.1 925872 172444450.10994548 40.15805889527003 2 | 0.2 925872 33079770.709359594 40.37226136366526 3 | 0.4 925872 6624229.742173558 40.23330388228099 4 | 0.8 925872 1158535.7267870877 40.35893230358759 5 | 1.6 925872 281033.55841735937 40.58177008310953 6 | 3.2 925872 151632.5929406516 40.396769646803534 7 | 6.4 925872 163300.0919435557 40.26944860855739 8 | 12.8 925872 172850.37634841524 40.34044620196025 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_one_path_Deezer.txt: -------------------------------------------------------------------------------- 1 | 0.1 846915 67621767.08185586 17.96943687995275 2 | 0.2 846915 12834610.144408561 18.013886676629383 3 | 0.4 846915 2402118.0028179446 18.083494160970055 4 | 0.8 846915 500496.8516409145 18.11883368094762 5 | 1.6 846915 274178.06109955686 18.175756443341577 6 | 3.2 846915 309180.5974108484 17.92412852843602 7 | 6.4 846915 330393.2308941875 18.501128292878466 8 | 12.8 846915 282934.33963861834 18.63744409402212 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_rectangle_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.1 262339 12686433345.902206 45.56635403235754 2 | 0.2 262339 6463662817.782363 45.47925840218862 3 | 0.4 262339 2850764092.5476236 44.98336447079977 4 | 0.8 262339 964200383.4405679 45.054958911736804 5 | 1.6 262339 243603323.29673934 45.1265027542909 6 | 3.2 262339 42779953.908614084 45.3920071264108 7 | 6.4 262339 3246245.4798771944 45.107735975583395 8 | 12.8 262339 284376.5094490785 45.38140602906545 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_triangle_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 0.1 717719 5132714131.954354 31.61679563204448 2 | 0.2 717719 686148812.5380071 31.771203319231667 3 | 0.4 717719 75331184.7562878 31.698754009405775 4 | 0.8 717719 11912559.741040386 31.70975546518962 5 | 1.6 717719 1711458.254918009 31.585586001078287 6 | 3.2 717719 453016.4263731321 31.720349313418076 7 | 6.4 717719 238254.42893112154 31.63185273090998 8 | 12.8 717719 203264.74745812424 31.59635181585948 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_triangle_Deezer.txt: -------------------------------------------------------------------------------- 1 | 0.1 794210 3055518850.257423 23.213933484554293 2 | 0.2 794210 354453496.8328513 23.055413410663604 3 | 0.4 794210 48191811.38595099 22.946531281471252 4 | 0.8 794210 6209570.0671949005 22.981451992988585 5 | 1.6 794210 1108390.1349530243 22.86427252054214 6 | 3.2 794210 533734.8021481438 23.2701957654953 7 | 6.4 794210 513316.08438917884 22.87713435411453 8 | 12.8 794210 447263.88719556335 22.751755456924435 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_triangle_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.1 120676 1813548811.5416324 45.02062052289645 2 | 0.2 120676 778927699.1713818 45.29002861777941 3 | 0.4 120676 322292448.5377043 45.32420906821886 4 | 0.8 120676 126996700.91763209 44.98867195645968 5 | 1.6 120676 31670776.458788186 45.2618742565314 6 | 3.2 120676 6100392.084997826 45.61195720831553 7 | 6.4 120676 751631.8460480189 45.31869078079859 8 | 12.8 120676 91455.19711275294 45.09190636674563 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_one_path_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 0.1 899792 36766561.19246631 4568.625626147588 2 | 0.2 899792 15584093.96080144 4568.615711596806 3 | 0.4 899792 6443129.243247523 4568.614719572864 4 | 0.8 899792 3269786.3606680334 4568.618523889383 5 | 1.6 899792 1373944.102470279 4568.610624345143 6 | 3.2 899792 497666.21654792555 4568.6073186286285 7 | 6.4 899792 354360.92456506175 4568.610089433989 8 | 12.8 899792 189589.5148199431 4568.6139408500985 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_one_path_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 0.1 925872 28943237.143721733 1125.3372508835791 2 | 0.2 925872 12316332.27183381 1125.3352003502848 3 | 0.4 925872 5484121.486484114 1125.3357170724867 4 | 0.8 925872 2644636.879078389 1125.3366086292267 5 | 1.6 925872 1116741.4241280945 1125.3375283360479 6 | 3.2 925872 484840.70670112 1125.333233013153 7 | 6.4 925872 264170.1629666722 1125.3342051219938 8 | 12.8 925872 140126.65140381403 1125.345033881664 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_triangle_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.1 120676 42566871.33019778 296.6668759981791 2 | 0.2 120676 18291504.70621021 296.67563537160555 3 | 0.4 120676 9025640.762981752 296.6695495645205 4 | 0.8 120676 4626198.58413359 296.6762491027514 5 | 1.6 120676 2428586.3162278975 296.6727820018927 6 | 3.2 120676 1010400.4223466971 296.67346954743067 7 | 6.4 120676 467053.9737075871 296.6675562898318 8 | 12.8 120676 267646.57537389826 296.67896480361617 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_rectangle_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 0.1 2477087 711450381835.6755 35.868436367511755 2 | 0.2 2477087 85183953284.44727 35.736287240982065 3 | 0.4 2477087 7673146352.709226 35.69258045434952 4 | 0.8 2477087 759243630.057382 35.75184647798538 5 | 1.6 2477087 86283337.84482177 35.644069924354554 6 | 3.2 2477087 12115234.38839514 35.74204204320908 7 | 6.4 2477087 3073415.149653637 35.751830258369445 8 | 12.8 2477087 2159735.897589858 35.69838079214096 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_two_path_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 0.1 9752186 18681262548.34988 41.24642731189728 2 | 0.2 9752186 2278110636.4203157 41.28290866613388 3 | 0.4 9752186 305336370.4109835 41.134644570350645 4 | 0.8 9752186 37992599.13970532 40.95925930500031 5 | 1.6 9752186 7431208.498543593 40.73741511583329 6 | 3.2 9752186 4283532.138823734 40.937043485641475 7 | 6.4 9752186 3866669.9475704934 41.27214968442917 8 | 12.8 9752186 4076255.375315087 40.89866344690322 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_two_path_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.1 5995090 5693437519.314351 44.49767357508342 2 | 0.2 5995090 2398319881.0325494 44.180537656943 3 | 0.4 5995090 1096953352.8332746 44.1367144147555 4 | 0.8 5995090 391352506.4923319 44.25780953566233 5 | 1.6 5995090 101246980.30075377 44.1282168785731 6 | 3.2 5995090 19021383.457077138 44.39784366885821 7 | 6.4 5995090 4632509.965959213 44.24692104260127 8 | 12.8 5995090 2032518.899411025 44.195003763834634 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_rectangle_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.1 262339 303828368.82749295 300.3941265702248 2 | 0.2 262339 121776298.63950086 300.3903922498226 3 | 0.4 262339 57212932.935935855 300.3872980475426 4 | 0.8 262339 23945573.582926437 300.3864443421364 5 | 1.6 262339 9924651.696139496 300.39898468852044 6 | 3.2 262339 5033042.628602195 300.3988073468208 7 | 6.4 262339 1986812.819493815 300.38967161178584 8 | 12.8 262339 1222300.4402131038 300.3928427398205 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_triangle_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 0.1 667129 911557978.8605311 1128.7824506465595 2 | 0.2 667129 361881267.63468397 1128.7769888154667 3 | 0.4 667129 151592570.48858365 1128.7806748286882 4 | 0.8 667129 64045278.06678068 1128.7821703950563 5 | 1.6 667129 26938444.399578236 1128.7791739575068 6 | 3.2 667129 11788040.274244646 1128.7867529980342 7 | 6.4 667129 5142311.553476345 1128.779137772719 8 | 12.8 667129 2206239.1049626344 1128.777169105212 9 | -------------------------------------------------------------------------------- /Result/TPCH/R2T_Q21.txt: -------------------------------------------------------------------------------- 1 | 0.1 6001215.0 312822.1499979201 83.89120366573334 2 | 0.2 6001215.0 199634.5915591144 83.83245379924774 3 | 0.4 6001215.0 72467.95507792306 82.84704995155334 4 | 0.8 6001215.0 39262.24098264737 82.88869867324829 5 | 1.6 6001215.0 20422.871958295505 83.20966098308563 6 | 3.2 6001215.0 9861.957912246851 82.7638837337494 7 | 6.4 6001215.0 5537.22225342008 83.22351069450379 8 | 12.8 6001215.0 2469.047756969618 83.35153613090515 9 | -------------------------------------------------------------------------------- /Result/TPCH/R2T_Q5.txt: -------------------------------------------------------------------------------- 1 | 0.1 239917.0 12391.997609030994 2.697705054283142 2 | 0.2 239917.0 7874.554346221004 2.706153130531311 3 | 0.4 239917.0 5278.08497000214 2.607061243057251 4 | 0.8 239917.0 3901.5401625651916 2.700205159187317 5 | 1.6 239917.0 3187.6058447491814 2.6184929609298706 6 | 3.2 239917.0 1824.1603738995134 2.6263866662979125 7 | 6.4 239917.0 875.2169559938047 2.6432378768920897 8 | 12.8 239917.0 465.64271294654947 2.6464807987213135 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_triangle_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 0.1 667129.0 223923.446079037 9.785640288432436 2 | 0.2 667129.0 163381.0187441725 9.74189993683497 3 | 0.4 667129.0 118335.59091134062 9.860526278893147 4 | 0.8 667129.0 94930.30116996523 9.816120396534592 5 | 1.6 667129.0 79133.50532897217 10.066150769631061 6 | 3.2 667129.0 44512.545618493175 9.810614455779398 7 | 6.4 667129.0 29347.14649288199 9.710375190575924 8 | 12.8 667129.0 30959.819541542074 9.990061672051754 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_one_path_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.1 2766607 546429506.7994654 39.76240269541741 2 | 0.2 2766607 264459804.86299646 39.83737685084343 3 | 0.4 2766607 108610175.44386795 39.608454537391665 4 | 0.8 2766607 38967672.07548333 39.71991449594498 5 | 1.6 2766607 10545543.124530144 39.321614229679106 6 | 3.2 2766607 2822906.1433185055 39.26529155373573 7 | 6.4 2766607 1195932.953584175 39.828603595495224 8 | 12.8 2766607 613088.3307860118 39.931714749336244 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_one_path_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 1541898 302446982.6171564 21.753631621599197 2 | 0.2 1541898 144134410.3274666 21.93845998048782 3 | 0.4 1541898 61746893.95261307 22.01174631714821 4 | 0.8 1541898 21157427.793265495 21.914826881885528 5 | 1.6 1541898 5522157.21033499 21.977753037214278 6 | 3.2 1541898 1604557.948362241 22.049864143133163 7 | 6.4 1541898 734965.8680609813 21.946683537960055 8 | 12.8 1541898 357667.838736368 21.873152643442154 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_rectangle_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 0.1 3125323 959046552680.7269 50.874371174971266 2 | 0.2 3125323 95429824646.29776 50.71710367838541 3 | 0.4 3125323 8976150676.62633 50.47282178084056 4 | 0.8 3125323 816550061.4170487 50.572261847654985 5 | 1.6 3125323 91083679.24763729 50.443855046431224 6 | 3.2 3125323 10331027.727458147 51.04569796721141 7 | 6.4 3125323 3769702.8846303956 50.59568064133326 8 | 12.8 3125323 2965768.3668898516 50.46952372233073 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_rectangle_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 157802 7440071008.787059 24.862106144428253 2 | 0.2 157802 3359216632.8278127 24.64023525118828 3 | 0.4 157802 1353543005.2961998 24.741515511274336 4 | 0.8 157802 504062837.03868747 24.774698573350907 5 | 1.6 157802 128064778.11859871 24.708191639184953 6 | 3.2 157802 22201332.5075495 24.848981380462646 7 | 6.4 157802 2005587.2656175022 24.803979712724686 8 | 12.8 157802 165397.20203857237 24.667604964971545 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_two_path_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 0.1 9120350 14652686144.613781 28.553981138070423 2 | 0.2 9120350 1825980174.4270837 28.6123697479566 3 | 0.4 9120350 229037379.7114975 28.66315474351247 4 | 0.8 9120350 36273366.53304414 28.397438453038536 5 | 1.6 9120350 7687114.915286624 28.188583925565087 6 | 3.2 9120350 3989268.1096739545 28.28005669434865 7 | 6.4 9120350 3480152.0439225733 28.277732258637748 8 | 12.8 9120350 3513897.162700685 28.46508455594381 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_one_path_Deezer.txt: -------------------------------------------------------------------------------- 1 | 0.1 846915.0 23832.394856794057 9.042019248008728 2 | 0.2 846915.0 14598.037667910297 8.87136173248291 3 | 0.4 846915.0 7987.642586412355 8.904619193077087 4 | 0.8 846915.0 4529.810262647826 8.75525505542755 5 | 1.6 846915.0 2938.2402888788492 8.732214379310609 6 | 3.2 846915.0 2149.445321213842 9.26238579750061 7 | 6.4 846915.0 1745.9659291978653 9.070059633255005 8 | 12.8 846915.0 1171.7787529974205 8.614673328399657 9 | -------------------------------------------------------------------------------- /Result/Graph/RM_triangle_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 67150.0 152.32814592307355 1257.2967702547708 2 | 0.2 67150.0 89.01980722439475 1207.252150416374 3 | 0.4 67150.0 72.26659182095075 1280.8943740526834 4 | 0.8 67150.0 26.05546674310123 1280.935146212578 5 | 1.6 67150.0 14.892070889242556 1264.0117518901825 6 | 3.2 67150.0 6.106439992142744 1265.9560392697654 7 | 6.4 67150.0 4.5847635285924 1264.8437778949738 8 | 12.8 67150.0 3.354529136685111 1245.3478778600693 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_rectangle_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 0.1 2477087 11589812114851.17 4575.5150556810695 2 | 0.2 2477087 4202081952621.221 4575.514099593956 3 | 0.4 2477087 1117457996595.3208 4575.513540156682 4 | 0.8 2477087 282989205897.3786 4575.511908980209 5 | 1.6 2477087 83977466977.78276 4575.513799489338 6 | 3.2 2477087 12999927283.97214 4575.5163502891855 7 | 6.4 2477087 6905535043.280424 4575.514254573186 8 | 12.8 2477087 2212610508.6306396 4575.521343901952 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_rectangle_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 0.1 3125323 219197423250.9997 1140.7482402841251 2 | 0.2 3125323 65248665373.54185 1140.751962129275 3 | 0.4 3125323 20668927471.52702 1140.7472413531937 4 | 0.8 3125323 6302185538.2233715 1140.749095448653 5 | 1.6 3125323 2566938870.3246055 1140.7571035639444 6 | 3.2 3125323 1091963092.1855593 1140.760775384108 7 | 6.4 3125323 473259038.66224843 1140.7614340464274 8 | 12.8 3125323 232385407.8875343 1140.7508740894 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_rectangle_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 157802 232408633.46971136 107.68013364076614 2 | 0.2 157802 84373042.29774176 107.67697947025297 3 | 0.4 157802 40484620.68321038 107.67852301001548 4 | 0.8 157802 16284026.030464226 107.68644643425942 5 | 1.6 157802 7303087.510343223 107.67484567165374 6 | 3.2 157802 3644427.2378177126 107.6784973204136 7 | 6.4 157802 1647769.2734185471 107.67444901466371 8 | 12.8 157802 714914.8645626631 107.67723353505133 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_two_path_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 0.1 9120350 25359250108.967144 4569.649260071119 2 | 0.2 9120350 6375616603.626447 4569.646783285935 3 | 0.4 9120350 1879388886.654686 4569.649630051454 4 | 0.8 9120350 465810939.84767205 4569.6443553741765 5 | 1.6 9120350 204805299.43615282 4569.647809961637 6 | 3.2 9120350 73159447.11804155 4569.653961699803 7 | 6.4 9120350 25953453.002475217 4569.655099092324 8 | 12.8 9120350 12369679.841589129 4569.65186239322 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_two_path_Deezer.txt: -------------------------------------------------------------------------------- 1 | 0.1 21820149 81519457595.8439 9872.688280045191 2 | 0.2 21820149 22089595998.251373 9872.692307907742 3 | 0.4 21820149 5374478200.172011 9872.696813203493 4 | 0.8 21820149 1942681695.195329 9872.693819123906 5 | 1.6 21820149 624677065.2410139 9872.691415087384 6 | 3.2 21820149 220146248.6618521 9872.690464097659 7 | 6.4 21820149 88943532.41307169 9872.693946308294 8 | 12.8 21820149 33652389.66357529 9872.693398076693 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_two_path_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.1 5995090 99097625.65112738 295.7887692471345 2 | 0.2 5995090 60493419.154766895 295.78595244487127 3 | 0.4 5995090 29134089.81171984 295.77944579323133 4 | 0.8 5995090 13670745.577272965 295.77593485315634 5 | 1.6 5995090 6182962.033007828 295.79022720058754 6 | 3.2 5995090 2608674.510635905 295.791793747743 7 | 6.4 5995090 1434566.657240288 295.79378940065703 8 | 12.8 5995090 559576.8684646247 295.78464423616725 9 | -------------------------------------------------------------------------------- /Result/TPCH/R2T_Q12.txt: -------------------------------------------------------------------------------- 1 | 0.1 6001215.0 12247.16397026709 7.664567470550537 2 | 0.2 6001215.0 5459.559465200019 7.604888224601746 3 | 0.4 6001215.0 2403.0065402605883 7.665322232246399 4 | 0.8 6001215.0 1372.9819668734756 7.644412875175476 5 | 1.6 6001215.0 623.8961252709851 7.694009327888489 6 | 3.2 6001215.0 245.9168479749933 7.6248612880706785 7 | 6.4 6001215.0 181.9928187408174 7.727485156059265 8 | 12.8 6001215.0 85.72116837029655 7.663781642913818 9 | -------------------------------------------------------------------------------- /Result/TPCH/R2T_Q20.txt: -------------------------------------------------------------------------------- 1 | 0.1 6001215.0 299765.88876281475 4.887974882125855 2 | 0.2 6001215.0 139533.29390036548 4.980894470214844 3 | 0.4 6001215.0 73398.07888560851 4.969114184379578 4 | 0.8 6001215.0 34725.64079950517 4.990521502494812 5 | 1.6 6001215.0 20303.230928386252 4.995060586929322 6 | 3.2 6001215.0 8503.356561301121 4.98987123966217 7 | 6.4 6001215.0 3846.317957703024 4.947370290756226 8 | 12.8 6001215.0 2675.0825588478087 4.938201642036438 9 | -------------------------------------------------------------------------------- /Result/TPCH/R2T_Q3.txt: -------------------------------------------------------------------------------- 1 | 0.1 2888656.0 65753.4056545704 3.161558198928833 2 | 0.2 2888656.0 32649.846293927945 3.049985432624817 3 | 0.4 2888656.0 14337.805428293612 3.0282631397247313 4 | 0.8 2888656.0 7338.6182154278895 3.016700768470764 5 | 1.6 2888656.0 2745.9042518826514 3.0519538640975954 6 | 3.2 2888656.0 1983.2147479262203 3.0199405431747435 7 | 6.4 2888656.0 840.5937194467988 3.013276290893555 8 | 12.8 2888656.0 549.8165564620091 3.006199908256531 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_one_path_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 0.1 925872.0 63558.48683289471 10.243146125555038 2 | 0.2 925872.0 70939.5327718597 10.578455828746158 3 | 0.4 925872.0 73172.88454785944 10.336300837834683 4 | 0.8 925872.0 62466.17851523286 10.209220910151798 5 | 1.6 925872.0 70616.01333559446 10.413135949214304 6 | 3.2 925872.0 65128.80801004654 10.11765393344561 7 | 6.4 925872.0 89650.38199231356 10.666639269272508 8 | 12.8 925872.0 62858.57413219196 10.251829075574875 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_rectangle_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.1 262339.0 3307.611442850759 4.400400094270722 2 | 0.2 262339.0 1470.988704830132 4.4147043569088105 3 | 0.4 262339.0 869.6399758229531 4.422054750204098 4 | 0.8 262339.0 434.1469080960542 4.373266500711452 5 | 1.6 262339.0 195.57627260404905 4.341042686700831 6 | 3.2 262339.0 150.85710704958163 4.341207657655089 7 | 6.4 262339.0 101.06932351099793 4.368900296847036 8 | 12.8 262339.0 51.33571349739658 4.319015964269654 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_triangle_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 67150.0 402.27470340319513 0.7892599870363848 2 | 0.2 67150.0 230.49331768081635 0.7877651267051677 3 | 0.4 67150.0 121.3198443519634 0.7896126237710293 4 | 0.8 67150.0 69.54474341354228 0.7914322208563457 5 | 1.6 67150.0 36.80240760883841 0.7866864199638343 6 | 3.2 67150.0 18.904433869095318 0.7889060549736011 7 | 6.4 67150.0 10.928200458384312 0.7858767365614542 8 | 12.8 67150.0 7.071742525326283 0.7962556019624051 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_rectangle_Deezer.txt: -------------------------------------------------------------------------------- 1 | 0.1 11866271 458457418110.8719 57.486915155251815 2 | 0.2 11866271 45260695432.98352 57.58636238654454 3 | 0.4 11866271 5159939862.867624 57.442473271687824 4 | 0.8 11866271 445368151.1815617 57.55679206689199 5 | 1.6 11866271 56334481.347825155 57.6041963895162 6 | 3.2 11866271 14344996.523516187 57.67252661546071 7 | 6.4 11866271 11356712.472006433 57.822532971700035 8 | 12.8 11866271 11017873.61781304 57.80216014226278 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_two_path_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 3390667 3110708671.9680276 23.145485268036524 2 | 0.2 3390667 1287799627.2765172 23.327048728863403 3 | 0.4 3390667 525300903.8580181 23.41375275651614 4 | 0.8 3390667 208834902.46989655 23.192970154682794 5 | 1.6 3390667 57804917.052575596 23.225388387839 6 | 3.2 3390667 10461208.248310538 23.361168501774472 7 | 6.4 3390667 2592783.757901193 23.047838781277335 8 | 12.8 3390667 1087823.990480665 23.256141446034114 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_triangle_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 0.1 667129.0 72168.42184109853 11.83529465198517 2 | 0.2 667129.0 36188.4711210283 11.49797854423523 3 | 0.4 667129.0 22258.694086827338 11.303284192085266 4 | 0.8 667129.0 13531.435465505812 11.420415782928467 5 | 1.6 667129.0 8150.133311396504 11.316963410377502 6 | 3.2 667129.0 6598.232064252098 11.484906578063965 7 | 6.4 667129.0 4237.250812148016 11.287788987159729 8 | 12.8 667129.0 2356.91666147043 11.217493963241576 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_triangle_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 67150.0 484.73744915727485 1.016123604774475 2 | 0.2 67150.0 288.041016284665 1.0186474800109864 3 | 0.4 67150.0 134.22923153362595 1.027350091934204 4 | 0.8 67150.0 68.17611956092878 1.0485478639602661 5 | 1.6 67150.0 36.970087351243514 1.0255290031433106 6 | 3.2 67150.0 22.16006030619125 1.0192153215408326 7 | 6.4 67150.0 11.286009971069385 0.9967784404754638 8 | 12.8 67150.0 7.73443986120886 0.9794461965560913 9 | -------------------------------------------------------------------------------- /Result/Graph/RM_triangle_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.1 120676.0 210.59520970462472 2524.316627502441 2 | 0.2 120676.0 79.35535401157297 2523.698097745578 3 | 0.3 120676.0 41.20257244778137 2529.698097745578 4 | 0.8 120676.0 23.23897508834246 2548.392835497856 5 | 1.6 120676.0 12.26651711728239 2547.392835497856 6 | 3.2 120676.0 9.010058253217721 2529.934423128764 7 | 6.4 120676.0 3.555501678834844 2534.584110220273 8 | 12.8 120676.0 2.0695131336930598 2546.522786855698 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_one_path_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.1 2766607 12100172.582827616 292.48040949106223 2 | 0.2 2766607 6443615.320357011 292.4780602097511 3 | 0.4 2766607 3326935.5716495123 292.4797608554364 4 | 0.8 2766607 2262037.1756459055 292.4735965311527 5 | 1.6 2766607 813192.4463942122 292.47662357687955 6 | 3.2 2766607 352971.68696107715 292.48337271213535 7 | 6.4 2766607 145852.59880332352 292.4819706022739 8 | 12.8 2766607 101946.6103831819 292.46836269497874 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_one_path_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 1541898 8054931.947865612 105.05321401953697 2 | 0.2 1541898 3565867.5075734034 105.05558611154557 3 | 0.4 1541898 1995475.7944561574 105.04949036836624 4 | 0.8 1541898 851076.4444952016 105.04788504242897 5 | 1.6 1541898 444118.5587989919 105.05648202300071 6 | 3.2 1541898 177090.30853071905 105.0549800336361 7 | 6.4 1541898 176573.92573566982 105.05352558493614 8 | 12.8 1541898 57755.49496247813 105.0557917535305 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_rectangle_Deezer.txt: -------------------------------------------------------------------------------- 1 | 0.1 11866271 47145585083485.055 9926.243411453564 2 | 0.2 11866271 11615839125127.297 9926.244446681341 3 | 0.4 11866271 3525918808712.2544 9926.237954057058 4 | 0.8 11866271 827572036970.2661 9926.243636265595 5 | 1.6 11866271 190079057343.63635 9926.239305771192 6 | 3.2 11866271 60716431453.07396 9926.236858118376 7 | 6.4 11866271 18314837933.64843 9926.24552167972 8 | 12.8 11866271 6500514810.978377 9926.241126383147 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_two_path_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 0.1 9752186 2685438638.2340617 1127.109021525383 2 | 0.2 9752186 1057843174.0990155 1127.1088771033287 3 | 0.4 9752186 431319860.3790268 1127.1098978447912 4 | 0.8 9752186 188262166.3373503 1127.1093740534782 5 | 1.6 9752186 78539314.90140164 1127.1097921776773 6 | 3.2 9752186 35027469.30245727 1127.1085310912133 7 | 6.4 9752186 15444379.525860894 1127.1078493833543 8 | 12.8 9752186 7644135.152107844 1127.1072582507134 9 | -------------------------------------------------------------------------------- /Result/Graph/SDE_two_path_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 3390667 80368143.10120912 104.38407343029976 2 | 0.2 3390667 29671038.71512399 104.38904752731324 3 | 0.4 3390667 15946180.845121393 104.38138231039048 4 | 0.8 3390667 7148306.4380354695 104.37499977350234 5 | 1.6 3390667 3982670.235036669 104.38289641737938 6 | 3.2 3390667 2070849.108171742 104.38182948827743 7 | 6.4 3390667 701984.1168592756 104.38216395378113 8 | 12.8 3390667 394952.8044277919 104.39252435564995 9 | -------------------------------------------------------------------------------- /Result/TPCH/R2T_Q10.txt: -------------------------------------------------------------------------------- 1 | 0.1 1500000.0 10590.643082727756 1.612355852127075 2 | 0.2 1500000.0 6656.013116810161 1.625562882423401 3 | 0.4 1500000.0 3732.3103447734998 1.6480136871337892 4 | 0.8 1500000.0 2615.490131188417 1.667088770866394 5 | 1.6 1500000.0 2016.4051154804183 1.6552902221679688 6 | 3.2 1500000.0 1655.2390117983257 1.6450556993484498 7 | 6.4 1500000.0 891.2938430957341 1.6605276823043824 8 | 12.8 1500000.0 408.744494484039 1.6545441389083861 9 | -------------------------------------------------------------------------------- /Result/TPCH/R2T_Q8.txt: -------------------------------------------------------------------------------- 1 | 0.1 1829418.0 235111.8490220789 24.498011445999147 2 | 0.2 1829418.0 155745.03009990847 24.287518095970153 3 | 0.4 1829418.0 82753.88337264773 24.13598780632019 4 | 0.8 1829418.0 35086.624006453705 24.771938276290893 5 | 1.6 1829418.0 20589.176835934475 23.981154751777648 6 | 3.2 1829418.0 9830.486628941764 23.664085841178895 7 | 6.4 1829418.0 4958.343444668222 23.426330089569092 8 | 12.8 1829418.0 3155.1671322549614 23.269581198692322 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_one_path_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 0.1 899792.0 49156.07541584146 10.685976724068391 2 | 0.2 899792.0 47582.03018826178 10.599416096846316 3 | 0.4 899792.0 67853.23523947646 11.232934387366047 4 | 0.8 899792.0 51444.18322966821 10.796076772769343 5 | 1.6 899792.0 47876.14104632672 10.556532368342138 6 | 3.2 899792.0 57850.59972576854 10.900662665844019 7 | 6.4 899792.0 54581.446508047826 11.022092341979398 8 | 12.8 899792.0 65831.90261521585 11.065563484033001 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_one_path_Deezer.txt: -------------------------------------------------------------------------------- 1 | 0.1 846915.0 142488.7254577661 13.78888839697839 2 | 0.2 846915.0 129424.41908891297 13.476227200269717 3 | 0.4 846915.0 129007.20146593798 13.396225330193838 4 | 0.8 846915.0 121468.5300992959 13.292014375130362 5 | 1.6 846915.0 136829.08586619713 13.792056379000362 6 | 3.2 846915.0 137098.39584660003 13.777512266159086 7 | 6.4 846915.0 127806.45770361504 13.301022519270601 8 | 12.8 846915.0 136510.71225744588 13.743440881172827 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_rectangle_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 0.1 2477087.0 10088630.1347238 45.69146612660076 2 | 0.2 2477087.0 6231967.222964589 45.52617135294264 3 | 0.4 2477087.0 3014629.3319846736 45.84041061385458 4 | 0.8 2477087.0 2348602.9144795397 45.7497848192055 5 | 1.6 2477087.0 1885778.5168115369 47.06129730765008 6 | 3.2 2477087.0 934045.5472029326 44.71303880206734 7 | 6.4 2477087.0 924537.7031131106 46.79504394737859 8 | 12.8 2477087.0 724343.9632494447 46.68764196602498 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_rectangle_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 157802.0 2530.597239919083 2.483619703769695 2 | 0.2 157802.0 1622.5384158444137 2.5039006311893597 3 | 0.4 157802.0 613.2364017931052 2.457483405590069 4 | 0.8 157802.0 352.0092935400647 2.482033056894953 5 | 1.6 157802.0 192.39378061726683 2.488717932065335 6 | 3.2 157802.0 115.37656393517956 2.4997408183415857 7 | 6.4 157802.0 76.13306136439287 2.493937384128586 8 | 12.8 157802.0 37.30909172113599 2.499560534795135 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_triangle_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 0.1 717719.0 205330.41719612057 11.366092948993085 2 | 0.2 717719.0 167561.3710645467 11.292294824679736 3 | 0.4 717719.0 135085.02418376898 11.309973522981037 4 | 0.8 717719.0 91799.16805263254 11.376784822543478 5 | 1.6 717719.0 59461.790933721764 11.067195182641376 6 | 3.2 717719.0 34694.85925382 11.20650494694711 7 | 6.4 717719.0 29802.159876950023 11.211717643260968 8 | 12.8 717719.0 17848.294082503744 11.047303811550176 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_triangle_Deezer.txt: -------------------------------------------------------------------------------- 1 | 0.1 794210.0 369125.21578434453 123.29408538325673 2 | 0.2 794210.0 284438.90242959093 137.58537949736981 3 | 0.4 794210.0 221762.07935066172 105.76317787361201 4 | 0.8 794210.0 195706.22091532697 124.2782539892202 5 | 1.6 794210.0 180089.742597294 133.95812501382878 6 | 3.2 794210.0 150784.1284370554 132.6301523887323 7 | 6.4 794210.0 94870.66065287674 120.21230997204837 8 | 12.8 794210.0 113995.51682304946 138.67068884603268 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_triangle_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.1 120676.0 491.1003995323428 1.3764682189623552 2 | 0.2 120676.0 243.14820123599122 1.3822708595593787 3 | 0.4 120676.0 126.67231680377269 1.3795929698149387 4 | 0.8 120676.0 75.4735053579899 1.374101381699246 5 | 1.6 120676.0 47.75304193435673 1.3756957419713378 6 | 3.2 120676.0 20.072260471310067 1.3788138940334353 7 | 6.4 120676.0 12.333656274232888 1.3807861638069157 8 | 12.8 120676.0 8.580447993863563 1.3779094993273462 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_two_path_Deezer.txt: -------------------------------------------------------------------------------- 1 | 0.1 21820149.0 8878793.095561696 8321.819797394184 2 | 0.2 21820149.0 8724974.45340817 8708.509688959199 3 | 0.4 21820149.0 7913942.141280106 8574.122496092472 4 | 0.8 21820149.0 7843524.594593219 8734.690279233695 5 | 1.6 21820149.0 9640081.531577205 9488.791563283774 6 | 3.2 21820149.0 8306999.534712 8803.77679955396 7 | 6.4 21820149.0 9036643.890690982 9347.559206152524 8 | 12.8 21820149.0 8490798.164993685 9032.496623103227 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_two_path_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.1 5995090.0 573161.4044742332 343.0526607158212 2 | 0.2 5995090.0 669879.4557026231 358.7351107638704 3 | 0.4 5995090.0 691108.762344859 360.2117070832284 4 | 0.8 5995090.0 797066.7753858815 378.85988106036456 5 | 1.6 5995090.0 802448.0759353271 379.5117590542667 6 | 3.2 5995090.0 712591.7112252279 361.7953817934228 7 | 6.4 5995090.0 696893.6119710244 360.7133074824845 8 | 12.8 5995090.0 711710.9078212931 366.9997734820869 9 | -------------------------------------------------------------------------------- /Result/Graph/NT_two_path_Deezer.txt: -------------------------------------------------------------------------------- 1 | 0.1 21820149 8436453697.217154 22.222386609713233 2 | 0.2 21820149 1112549247.095391 22.29019036213557 3 | 0.4 21820149 139584732.00913072 21.699973658720648 4 | 0.8 21820149 25409995.266979758 21.01790688196818 5 | 1.6 21820149 13595492.30613368 21.147025050322213 6 | 3.2 21820149 12668187.496956622 21.675685800711314 7 | 6.4 21820149 12104105.672905885 21.730597798029585 8 | 12.8 21820149 11501926.43790995 21.874436563650768 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_one_path_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 0.1 899792.0 23929.081749879057 11.476911354064942 2 | 0.2 899792.0 13870.178325812603 11.669807434082031 3 | 0.4 899792.0 7747.6686741369585 11.42943241596222 4 | 0.8 899792.0 5013.3989018733455 11.734513926506043 5 | 1.6 899792.0 3624.972210194508 11.726011037826538 6 | 3.2 899792.0 2572.907405411223 11.96724750995636 7 | 6.4 899792.0 2077.431526602692 11.256882286071777 8 | 12.8 899792.0 1104.2905218899832 11.07408266067505 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_one_path_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 0.1 925872.0 22896.784669990593 11.761513566970825 2 | 0.2 925872.0 14742.314486670191 12.151550555229187 3 | 0.4 925872.0 7602.153720353206 12.113780975341797 4 | 0.8 925872.0 4000.995271379458 12.003716564178466 5 | 1.6 925872.0 2743.1835155402855 11.927522206306458 6 | 3.2 925872.0 1677.8904336067305 11.9433162689209 7 | 6.4 925872.0 1403.4384070061108 11.625744223594666 8 | 12.8 925872.0 920.2517122512023 11.562832999229432 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_rectangle_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.1 262339.0 938.9708574643979 4.741282963752747 2 | 0.2 262339.0 514.3897537221104 4.76780903339386 3 | 0.4 262339.0 267.9185204066598 6.252346920967102 4 | 0.8 262339.0 167.46017473502434 6.328730940818787 5 | 1.6 262339.0 133.14562909619417 5.585931873321533 6 | 3.2 262339.0 96.16760199127991 4.7296714067459105 7 | 6.4 262339.0 78.60915257193847 4.927536988258362 8 | 12.8 262339.0 35.467880681283226 6.6400528907775875 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_rectangle_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 157802.0 898.6064766167838 3.7660152673721314 2 | 0.2 157802.0 420.770146759062 3.774965023994446 3 | 0.4 157802.0 222.73468823616955 3.4295405626296995 4 | 0.8 157802.0 115.0631931272704 2.8363725662231447 5 | 1.6 157802.0 73.41634774844472 2.8398019552230833 6 | 3.2 157802.0 46.041730250430795 2.9230101346969604 7 | 6.4 157802.0 28.75807645803434 3.616887354850769 8 | 12.8 157802.0 22.676500305276324 4.192280125617981 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_triangle_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 0.1 717719.0 61404.707352565114 12.2127769947052 2 | 0.2 717719.0 34057.34184373487 12.002558088302612 3 | 0.4 717719.0 15278.736453786492 11.979817605018615 4 | 0.8 717719.0 9105.701294257151 12.042966938018798 5 | 1.6 717719.0 6667.906734907224 11.698416113853455 6 | 3.2 717719.0 4619.762207653393 11.82809133529663 7 | 6.4 717719.0 3598.7784033969706 12.256566166877747 8 | 12.8 717719.0 2198.9921899936744 11.88123161792755 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_triangle_Deezer.txt: -------------------------------------------------------------------------------- 1 | 0.1 794210.0 195138.88311369705 10.51092824935913 2 | 0.2 794210.0 155892.2056481922 10.130466270446778 3 | 0.4 794210.0 82981.85065616551 10.059351348876953 4 | 0.8 794210.0 44344.97208285673 10.112754321098327 5 | 1.6 794210.0 20660.508394456352 9.987071633338928 6 | 3.2 794210.0 12192.855048095205 10.055700707435609 7 | 6.4 794210.0 7746.720462462923 10.073320960998535 8 | 12.8 794210.0 5352.92331570707 10.037227416038514 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_triangle_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.1 120676.0 512.7197320603276 2.0423285245895384 2 | 0.2 120676.0 383.02557625682675 2.183268666267395 3 | 0.4 120676.0 149.50779183581957 2.204890179634094 4 | 0.8 120676.0 73.66959854493325 1.812535858154297 5 | 1.6 120676.0 41.09109781809335 1.7419553756713868 6 | 3.2 120676.0 21.47062938921105 1.6694184064865112 7 | 6.4 120676.0 14.092944693703126 1.6961913108825684 8 | 12.8 120676.0 9.070633969616514 1.6775592803955077 9 | -------------------------------------------------------------------------------- /Result/Graph/RM_rectangle_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 157802.0 232.2263658591643 11100.72409904003 2 | 0.2 157802.0 127.33785999196213 11192.027000625927 3 | 0.4 157802.0 65.8649444798939 11182.023678064346 4 | 0.8 157802.0 34.287717619139585 10468.312948624294 5 | 1.6 157802.0 12.880162405577721 10518.47933415572 6 | 3.2 157802.0 9.912809791619657 10501.993185162544 7 | 6.4 157802.0 6.676842840931699 10623.022373080254 8 | 12.8 157802.0 3.207667909062972 10504.514336943626 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_one_path_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.1 2766607.0 111632.97324883334 45.298157555023835 2 | 0.2 2766607.0 82513.69482176771 44.059959285974585 3 | 0.4 2766607.0 120870.23116388363 45.691515620470135 4 | 0.8 2766607.0 83555.63691109799 44.09165364758186 5 | 1.6 2766607.0 97087.30927579751 44.68339257605879 6 | 3.2 2766607.0 85761.8867750016 44.20116821455963 7 | 6.4 2766607.0 117318.84595484947 45.529041614611984 8 | 12.8 2766607.0 101415.56762548396 44.85485114773121 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_one_path_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 1541898.0 32693.746076745392 21.719252802053944 2 | 0.2 1541898.0 54620.1643171401 22.60107528018942 3 | 0.4 1541898.0 44407.07974725674 22.191356690565616 4 | 0.8 1541898.0 55459.7692722626 22.637671936193996 5 | 1.6 1541898.0 61986.93992895527 22.895161903381254 6 | 3.2 1541898.0 62887.335443832424 22.934081328868764 7 | 6.4 1541898.0 69304.47067745336 23.189308185259396 8 | 12.8 1541898.0 41020.3250603209 22.062877397060305 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_two_path_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 0.1 9120350.0 4240247.947494423 4741.751971572862 2 | 0.2 9120350.0 3147577.957596838 4742.60831743819 3 | 0.4 9120350.0 2814032.9056338477 4804.7012606179605 4 | 0.8 9120350.0 2117830.1512209037 3558.0534066036394 5 | 1.6 9120350.0 2312970.8196501085 4425.437864397111 6 | 3.2 9120350.0 2344658.7697031773 4158.095468798221 7 | 6.4 9120350.0 2333466.687861252 4165.326362193567 8 | 12.8 9120350.0 2443436.708697964 4593.678785382339 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_one_path_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 1541898.0 1011.1452328708643 19.045376348495484 2 | 0.2 1541898.0 888.5921664656295 21.493943953514098 3 | 0.4 1541898.0 464.5693462317965 20.73281693458557 4 | 0.8 1541898.0 176.16648537948882 21.131528854370117 5 | 1.6 1541898.0 143.2189741950327 21.024253797531127 6 | 3.2 1541898.0 46.578598390954234 21.40120048522949 7 | 6.4 1541898.0 22.3540194799037 21.527848649024964 8 | 12.8 1541898.0 15.48118784247587 21.3493132352829 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_rectangle_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 0.1 2477087.0 508332.86674075184 46.06795923709869 2 | 0.2 2477087.0 373384.5318374825 45.58481402397156 3 | 0.4 2477087.0 234583.66841830127 45.035546112060544 4 | 0.8 2477087.0 155820.27945556166 45.79766647815704 5 | 1.6 2477087.0 131332.83094715458 44.15020101070404 6 | 3.2 2477087.0 96253.9028800559 45.895967268943785 7 | 6.4 2477087.0 57250.93691928801 45.90136067867279 8 | 12.8 2477087.0 31859.52201328186 45.806391429901126 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_rectangle_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 0.1 3125323.0 789821.0484824562 59.834870314598085 2 | 0.2 3125323.0 588688.1624415728 59.77454278469086 3 | 0.4 3125323.0 478103.6118523068 60.7846296787262 4 | 0.8 3125323.0 327679.8457307657 59.783391666412356 5 | 1.6 3125323.0 243972.5855283163 60.25959870815277 6 | 3.2 3125323.0 143658.9482216949 59.73909273147583 7 | 6.4 3125323.0 106492.24296895321 59.006660509109494 8 | 12.8 3125323.0 80923.40341608001 60.38191695213318 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_two_path_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 0.1 9752186.0 2399505.321244195 156.47704377174378 2 | 0.2 9752186.0 1523421.7800212384 154.38997581005097 3 | 0.4 9752186.0 1183756.304036136 153.0806970834732 4 | 0.8 9752186.0 883106.0061311309 151.94783380031586 5 | 1.6 9752186.0 748323.3870335653 151.83499765396118 6 | 3.2 9752186.0 446618.7394097789 151.80131154060365 7 | 6.4 9752186.0 306170.3648007003 152.20082740783693 8 | 12.8 9752186.0 242390.8559078068 150.86286356449128 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_two_path_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 3390667.0 4565.1552221480915 68.77917482852936 2 | 0.2 3390667.0 3389.637173740814 70.10892658233642 3 | 0.4 3390667.0 2345.126515201215 69.01265075206757 4 | 0.8 3390667.0 1827.4759521055191 66.06974210739136 5 | 1.6 3390667.0 1150.2408499252826 65.82538871765136 6 | 3.2 3390667.0 592.6387785050707 68.69013564586639 7 | 6.4 3390667.0 269.0798034276813 67.08432900905609 8 | 12.8 3390667.0 141.75841619144194 67.74858887195587 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_rectangle_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 0.1 3125323.0 13481329.66520602 52.739540778955075 2 | 0.2 3125323.0 5155713.521011386 53.351456207037174 3 | 0.4 3125323.0 3065152.6616411475 53.462675438404275 4 | 0.8 3125323.0 2431760.1420366755 54.221667904853994 5 | 1.6 3125323.0 1578174.3288842163 54.22271428847331 6 | 3.2 3125323.0 1545729.2459043798 54.26397225427643 7 | 6.4 3125323.0 1232076.7572076155 54.4223427108926 8 | 12.8 3125323.0 1029123.7210833806 53.26380028255797 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_rectangle_Deezer.txt: -------------------------------------------------------------------------------- 1 | 0.1 11866271.0 44215481.18809095 2329.9587049385677 2 | 0.2 11866271.0 19212111.296530705 2455.720673036258 3 | 0.4 11866271.0 15076118.29742278 2636.7925041128824 4 | 0.8 11866271.0 10983430.177493216 2426.4983930311178 5 | 1.6 11866271.0 8219787.171757247 2510.660773573713 6 | 3.2 11866271.0 6752857.36903375 2222.0426752278745 7 | 6.4 11866271.0 5927615.829770258 2326.0587150542733 8 | 12.8 11866271.0 5404270.29400589 2423.3976775290967 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_two_path_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 0.1 9752186.0 4054202.9289362207 440.17215330560805 2 | 0.2 9752186.0 3261353.3906179117 415.46879684368616 3 | 0.4 9752186.0 3064000.3974947995 430.86567002947953 4 | 0.8 9752186.0 2712442.307178024 416.49923910927583 5 | 1.6 9752186.0 2438090.4024505517 421.31383574588904 6 | 3.2 9752186.0 2424795.8521859273 414.4118365001664 7 | 6.4 9752186.0 2715278.4641115116 440.4289177769801 8 | 12.8 9752186.0 2569629.470347875 431.5655884280186 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_two_path_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 0.1 3390667.0 340842.23173205194 131.42940978280697 2 | 0.2 3390667.0 452510.1222707561 140.6860324712595 3 | 0.4 3390667.0 370260.41744905437 136.13294121019044 4 | 0.8 3390667.0 374681.51832707593 134.34332325990994 5 | 1.6 3390667.0 432169.87800802983 139.71490616710966 6 | 3.2 3390667.0 438605.0703040587 140.8190200787385 7 | 6.4 3390667.0 347169.90304702683 134.73528967316966 8 | 12.8 3390667.0 415857.99026919313 137.4172160801887 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_one_path_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.1 2766607.0 1252.2757804590121 39.016655349731444 2 | 0.2 2766607.0 776.3008214845322 38.97674539089203 3 | 0.4 2766607.0 385.50745092805784 38.89355120658875 4 | 0.8 2766607.0 175.77782861694382 38.697805285453796 5 | 1.6 2766607.0 125.14047361398116 39.43649692535401 6 | 3.2 2766607.0 62.571552452631295 39.201140785217284 7 | 6.4 2766607.0 35.03010259017659 39.801556777954104 8 | 12.8 2766607.0 11.176017875550315 38.583319020271304 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_two_path_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 0.1 9120350.0 2368332.5729320114 130.4361388683319 2 | 0.2 9120350.0 1750942.9033809751 130.2554696083069 3 | 0.4 9120350.0 1368260.9771401559 130.71289002895355 4 | 0.8 9120350.0 1110830.7674739347 129.63943490982055 5 | 1.6 9120350.0 934096.3263205177 130.01920702457429 6 | 3.2 9120350.0 584891.1483537732 129.86452238559724 7 | 6.4 9120350.0 414724.1191156069 129.6535590171814 8 | 12.8 9120350.0 356262.5912728521 130.00325140953063 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_two_path_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 0.1 5995090.0 6165.984673220664 120.87315309047699 2 | 0.2 5995090.0 4374.572499679867 120.47221927642822 3 | 0.4 5995090.0 2675.2260024376833 119.29123694896698 4 | 0.8 5995090.0 2108.5842606692263 119.76899530887604 5 | 1.6 5995090.0 955.0158411220958 119.83349723815918 6 | 3.2 5995090.0 597.0896449908614 118.1342633008957 7 | 6.4 5995090.0 222.76277062312388 119.56552138328553 8 | 12.8 5995090.0 130.9141000911283 119.92557299137115 9 | -------------------------------------------------------------------------------- /Result/TPCH/R2T_Q18.txt: -------------------------------------------------------------------------------- 1 | 0.1 153078795.0 1336230.3648109187 6.374109363555908 2 | 0.2 153078795.0 763048.0172601392 6.2869884967803955 3 | 0.4 153078795.0 432793.69637201726 6.376655006408692 4 | 0.8 153078795.0 201957.5274197956 6.298775219917298 5 | 1.6 153078795.0 99594.74061794083 6.360373520851136 6 | 3.2 153078795.0 47680.719164669514 6.380721545219421 7 | 6.4 153078795.0 22290.180942187708 6.3175862550735475 8 | 12.8 153078795.0 12163.462693775693 6.341963195800782 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_rectangle_Deezer.txt: -------------------------------------------------------------------------------- 1 | 0.1 11866271.0 6379041.250056554 2613.2154752016068 2 | 0.2 11866271.0 4812134.780915347 185.84004561901094 3 | 0.4 11866271.0 3823016.0917486046 185.21557841300964 4 | 0.8 11866271.0 2005468.7890949848 183.2452677488327 5 | 1.6 11866271.0 1176442.0403375009 183.6579335451126 6 | 3.2 11866271.0 724769.6642021626 183.57765107154847 7 | 6.4 11866271.0 531617.2364208192 183.81926288604737 8 | 12.8 11866271.0 376211.1905135503 182.8037262916565 9 | -------------------------------------------------------------------------------- /Result/Graph/R2T_two_path_Deezer.txt: -------------------------------------------------------------------------------- 1 | 0.1 21820149.0 4722662.012372755 276.27116639614104 2 | 0.2 21820149.0 3335915.0658718757 274.5016714334488 3 | 0.4 21820149.0 2608557.5966118374 273.711190366745 4 | 0.8 21820149.0 1448942.1848223724 275.16613898277285 5 | 1.6 21820149.0 954498.7934506225 274.4705591201782 6 | 3.2 21820149.0 607372.3938474556 275.0316087245941 7 | 6.4 21820149.0 444141.03356115083 274.74041311740876 8 | 12.8 21820149.0 363224.75184313086 273.51457273960114 9 | -------------------------------------------------------------------------------- /Query/Q8.txt: -------------------------------------------------------------------------------- 1 | select count(*) from ids as id1, ids as id2, nation as n1, nation as n2, customer, orders, lineitem, supplier, region where n1.N_NATIONKEY=customer.C_NATIONKEY and n2.N_NATIONKEY=supplier.S_NATIONKEY and customer.C_CUSTKEY=orders.O_CUSTKEY and orders.O_ORDERKEY=lineitem.L_ORDERKEY and lineitem.L_SUPPKEY=supplier.S_SUPPKEY and n1.n_regionkey = r_regionkey and id1.i_id = supplier.s_id and id2.i_id = customer.c_id and o_orderdate>=date'1995-01-01' and o_orderdate<=date'1996-12-31'; 2 | -------------------------------------------------------------------------------- /Result/TPCH/R2T_Q7.txt: -------------------------------------------------------------------------------- 1 | 0.1 218102223.88498166 8632905.691625029 92.00866718292237 2 | 0.2 218102223.88498166 4902437.628899872 92.00122876167298 3 | 0.4 218102223.88498166 2489204.7727607638 91.44941368103028 4 | 0.8 218102223.88498166 1324462.99430193 91.50898885726929 5 | 1.6 218102223.88498166 580082.5083739707 90.89017381668091 6 | 3.2 218102223.88498166 323605.0840713084 91.05700514316558 7 | 6.4 218102223.88498166 143996.6633211424 91.16531889438629 8 | 12.8 218102223.88498166 82168.66551742952 91.65689218044281 9 | -------------------------------------------------------------------------------- /Result/TPCH/R2T_Q11.txt: -------------------------------------------------------------------------------- 1 | 0.1 2003609.4090069411 298203.1975074594 0.7856941938400268 2 | 0.2 2003609.4090069411 150764.38258255238 0.7830017805099487 3 | 0.4 2003609.4090069411 58406.125354234864 0.7831536293029785 4 | 0.8 2003609.4090069411 36438.29662507004 0.767362093925476 5 | 1.6 2003609.4090069411 18311.12004958939 0.7828138589859008 6 | 3.2 2003609.4090069411 10917.212914884518 0.7852411270141602 7 | 6.4 2003609.4090069411 5157.746322653334 0.7720969200134278 8 | 12.8 2003609.4090069411 2416.247112166641 0.7725285291671753 9 | -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_triangle_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 256 2 | Time: 0.6463479200998942 3 | Query result: 67150 4 | LP result: 67150.0 5 | 128.0 6 | Time: 0.6766535441080729 7 | Query result: 67150 8 | LP result: 67150.0 9 | 64.0 10 | Time: 0.7085166772206625 11 | Query result: 67150 12 | LP result: 67150.0 13 | 32.0 14 | Time: 0.801739772160848 15 | Query result: 67150 16 | LP result: 67150.0 17 | 16.0 18 | Time: 0.9493727684020996 19 | Query result: 67150 20 | LP result: 67150.0 21 | 8.0 22 | Time: 0.7444069385528564 23 | Query result: 67150 24 | LP result: 67150.0 25 | 4.0 26 | Time: 0.8544201850891113 27 | Query result: 67150 28 | LP result: 67135.0 29 | 2.0 30 | Time: 0.9366786479949951 31 | Query result: 67150 32 | LP result: 66134.33333333333 33 | -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_triangle_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 256 2 | Time: 1.2834323247273762 3 | Query result: 120676 4 | LP result: 120676.0 5 | 128.0 6 | Time: 1.3348456223805745 7 | Query result: 120676 8 | LP result: 120676.0 9 | 64.0 10 | Time: 1.4462881882985432 11 | Query result: 120676 12 | LP result: 120676.0 13 | 32.0 14 | Time: 1.4201863606770833 15 | Query result: 120676 16 | LP result: 120676.0 17 | 16.0 18 | Time: 1.4791628519694011 19 | Query result: 120676 20 | LP result: 120676.0 21 | 8.0 22 | Time: 1.409908135732015 23 | Query result: 120676 24 | LP result: 120676.0 25 | 4.0 26 | Time: 1.229148308436076 27 | Query result: 120676 28 | LP result: 120646.0 29 | 2.0 30 | Time: 1.4227742354075115 31 | Query result: 120676 32 | LP result: 118100.0 33 | -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_two_path_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 256 2 | Time: 79.95497600237529 3 | Query result: 5995090 4 | LP result: 5995090.0 5 | 128.0 6 | Time: 83.3277457555135 7 | Query result: 5995090 8 | LP result: 5995090.0 9 | 64.0 10 | Time: 85.08863957722981 11 | Query result: 5995090 12 | LP result: 5995037.0 13 | 32.0 14 | Time: 68.24504884084065 15 | Query result: 5995090 16 | LP result: 5993043.0 17 | 16.0 18 | Time: 89.66414777437846 19 | Query result: 5995090 20 | LP result: 5843395.667063491 21 | 8.0 22 | Time: 510.9399380683899 23 | Query result: 5995090 24 | LP result: 4271351.610648083 25 | 4.0 26 | Time: 822.1593192418417 27 | Query result: 5995090 28 | LP result: 2398606.576499831 29 | 2.0 30 | Time: 1153.243622859319 31 | Query result: 5995090 32 | LP result: 1262417.5218254903 33 | -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_two_path_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 256 2 | Time: 41.91345985730489 3 | Query result: 3390667 4 | LP result: 3390667.0 5 | 128.0 6 | Time: 44.764840046564736 7 | Query result: 3390667 8 | LP result: 3390667.0 9 | 64.0 10 | Time: 44.16910982131958 11 | Query result: 3390667 12 | LP result: 3390667.0 13 | 32.0 14 | Time: 48.11526211102804 15 | Query result: 3390667 16 | LP result: 3389631.0 17 | 16.0 18 | Time: 48.11065316200256 19 | Query result: 3390667 20 | LP result: 3296012.3230158733 21 | 8.0 22 | Time: 265.3516023159027 23 | Query result: 3390667 24 | LP result: 2374955.946082847 25 | 4.0 26 | Time: 289.2670178413391 27 | Query result: 3390667 28 | LP result: 1324853.6774951676 29 | 2.0 30 | Time: 314.5194199879964 31 | Query result: 3390667 32 | LP result: 699042.2853174282 33 | -------------------------------------------------------------------------------- /Result/Graph/QueryTimeGraph.txt: -------------------------------------------------------------------------------- 1 | Amazon2 one_path 1.6150857210159302 2 | Amazon2 triangle 4.195729184150696 3 | Amazon2 two_path 13.779502296447754 4 | Amazon2 rectangle 15.643132781982422 5 | Amazon1 one_path 1.524560809135437 6 | Amazon1 triangle 5.026814246177674 7 | Amazon1 two_path 11.79656982421875 8 | Amazon1 rectangle 21.60214364528656 9 | RoadnetPA one_path 1.5084797859191894 10 | RoadnetPA triangle 2.963254952430725 11 | RoadnetPA two_path 6.388430333137512 12 | RoadnetPA rectangle 4.497399711608887 13 | RoadnetCA one_path 2.6393651247024534 14 | RoadnetCA triangle 5.167805767059326 15 | RoadnetCA two_path 6.063437271118164 16 | RoadnetCA rectangle 10.135561990737916 17 | Deezer one_path 1.2829735279083252 18 | Deezer triangle 4.531979703903199 19 | Deezer two_path 13.805022621154786 20 | Deezer rectangle 74.33917551040649 -------------------------------------------------------------------------------- /Result/Graph/ExtractInfoTimeGraph.txt: -------------------------------------------------------------------------------- 1 | Amazon2 one_path 4.226217150688171 2 | Amazon2 triangle 8.474390554428101 3 | Amazon2 two_path 44.47309532165527 4 | Amazon2 rectangle 27.015947556495668 5 | Amazon1 one_path 3.9130436182022095 6 | Amazon1 triangle 6.78120276927948 7 | Amazon1 two_path 39.956672763824464 8 | Amazon1 rectangle 24.67961730957031 9 | RoadnetPA one_path 5.628730154037475 10 | RoadnetPA triangle 3.1590389013290406 11 | RoadnetPA two_path 14.135238552093506 12 | RoadnetPA rectangle 5.345793557167053 13 | RoadnetCA one_path 9.9537992477417 14 | RoadnetCA triangle 5.687819337844848 15 | RoadnetCA two_path 25.639593601226807 16 | RoadnetCA rectangle 9.852962541580201 17 | Deezer one_path 3.5798303365707396 18 | Deezer triangle 7.220835876464844 19 | Deezer two_path 80.9567011833191 20 | Deezer rectangle 105.5051020860672 21 | -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_one_path_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 1024 2 | Time: 6.830557346343994 3 | Query result: 899792 4 | LP result: 899792.0 5 | 512.0 6 | Time: 6.61911153793335 7 | Query result: 899792 8 | LP result: 899792.0 9 | 256.0 10 | Time: 6.552484750747681 11 | Query result: 899792 12 | LP result: 899118.0 13 | 128.0 14 | Time: 6.962859233220418 15 | Query result: 899792 16 | LP result: 896645.0 17 | 64.0 18 | Time: 7.2038759390513105 19 | Query result: 899792 20 | LP result: 889984.0 21 | 32.0 22 | Time: 7.284502029418945 23 | Query result: 899792 24 | LP result: 871829.0 25 | 16.0 26 | Time: 9.031233151753744 27 | Query result: 899792 28 | LP result: 825914.5 29 | 8.0 30 | Time: 8.316697120666504 31 | Query result: 899792 32 | LP result: 711908.5 33 | 4.0 34 | Time: 28.38174573580424 35 | Query result: 899792 36 | LP result: 497093.5 37 | 2.0 38 | Time: 20.301244894663494 39 | Query result: 899792 40 | LP result: 258879.5 41 | -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_one_path_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 1024 2 | Time: 7.318759838740031 3 | Query result: 925872 4 | LP result: 925872.0 5 | 512.0 6 | Time: 7.5441538492838545 7 | Query result: 925872 8 | LP result: 925835.0 9 | 256.0 10 | Time: 7.562031348546346 11 | Query result: 925872 12 | LP result: 925511.0 13 | 128.0 14 | Time: 7.861486196517944 15 | Query result: 925872 16 | LP result: 923806.0 17 | 64.0 18 | Time: 7.595386823018392 19 | Query result: 925872 20 | LP result: 916180.0 21 | 32.0 22 | Time: 8.262920220692953 23 | Query result: 925872 24 | LP result: 889101.0 25 | 16.0 26 | Time: 8.583845535914103 27 | Query result: 925872 28 | LP result: 816366.0 29 | 8.0 30 | Time: 9.136393308639526 31 | Query result: 925872 32 | LP result: 670206.5 33 | 4.0 34 | Time: 16.341322263081867 35 | Query result: 925872 36 | LP result: 469859.0 37 | 2.0 38 | Time: 23.64388918876648 39 | Query result: 925872 40 | LP result: 280549.0 41 | -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_one_path_Deezer.txt: -------------------------------------------------------------------------------- 1 | 1024 2 | Time: 5.741204420725505 3 | Query result: 846915 4 | LP result: 846915.0 5 | 512.0 6 | Time: 6.085486729939778 7 | Query result: 846915 8 | LP result: 846915.0 9 | 256.0 10 | Time: 5.413238922754924 11 | Query result: 846915 12 | LP result: 846502.0 13 | 128.0 14 | Time: 5.698396921157837 15 | Query result: 846915 16 | LP result: 843281.0 17 | 64.0 18 | Time: 5.597248713175456 19 | Query result: 846915 20 | LP result: 822402.5 21 | 32.0 22 | Time: 7.457968393961589 23 | Query result: 846915 24 | LP result: 754533.5 25 | 16.0 26 | Time: 14.878064632415771 27 | Query result: 846915 28 | LP result: 605999.5 29 | 8.0 30 | Time: 26.41115403175354 31 | Query result: 846915 32 | LP result: 419237.5 33 | 4.0 34 | Time: 30.990416606267292 35 | Query result: 846915 36 | LP result: 252678.5 37 | 2.0 38 | Time: 27.813944339752197 39 | Query result: 846915 40 | LP result: 137919.5 41 | -------------------------------------------------------------------------------- /Result/Graph/LP_Diff_Tau.txt: -------------------------------------------------------------------------------- 1 | one_path 128.0 1437.9429831062098 2 | one_path 16.0 2101.203311879963 3 | one_path 2.0 109506.6121528087 4 | one_path 0.25 645323.4575339572 5 | one_path 0.03125 810138.0 6 | one_path 0.00390625 911405.25 7 | one_path 0.00048828125 924063.65625 8 | triangle 131072.0 1291827.9231163803 9 | triangle 16384.0 156675.5212510266 10 | triangle 2048.0 15110.944524649183 11 | triangle 256.0 2792.193093352197 12 | triangle 32.0 2086.3841637647697 13 | triangle 4.0 92332.41709046367 14 | triangle 0.5 458878.64232584904 15 | two_path 131072.0 1582431.688730755 16 | two_path 16384.0 181386.3958290501 17 | two_path 2048.0 258502.8842327213 18 | two_path 256.0 1261877.0769073819 19 | two_path 32.0 3946191.148328516 20 | two_path 4.0 7576019.181078645 21 | two_path 0.5 9344912.335648786 22 | rectangle 134217728.0 1366894680.524897 23 | rectangle 16777216.0 140251478.16429237 24 | rectangle 2097152.0 25831648.371697593 25 | rectangle 262144.0 2628528.5795824574 26 | rectangle 32768.0 273687.9308961947 27 | rectangle 4096.0 48671.029117108825 28 | rectangle 512.0 76357.66508422742 29 | -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_rectangle_RoadnetCA.txt: -------------------------------------------------------------------------------- 1 | 4096 2 | Time: 3.982926289240519 3 | Query result: 262339 4 | LP result: 262339.0 5 | 2048.0 6 | Time: 4.113158782323201 7 | Query result: 262339 8 | LP result: 262339.0 9 | 1024.0 10 | Time: 3.9389096101125083 11 | Query result: 262339 12 | LP result: 262339.0 13 | 512.0 14 | Time: 4.004607121149699 15 | Query result: 262339 16 | LP result: 262339.0 17 | 256.0 18 | Time: 4.319675842920939 19 | Query result: 262339 20 | LP result: 262339.0 21 | 128.0 22 | Time: 4.033473253250122 23 | Query result: 262339 24 | LP result: 262339.0 25 | 64.0 26 | Time: 4.082391579945882 27 | Query result: 262339 28 | LP result: 262339.0 29 | 32.0 30 | Time: 4.528538942337036 31 | Query result: 262339 32 | LP result: 262339.0 33 | 16.0 34 | Time: 4.109328031539917 35 | Query result: 262339 36 | LP result: 262339.0 37 | 8.0 38 | Time: 4.193301200866699 39 | Query result: 262339 40 | LP result: 262337.0 41 | 4.0 42 | Time: 4.200072209040324 43 | Query result: 262339 44 | LP result: 261878.16666666672 45 | 2.0 46 | Time: 6.926599343617757 47 | Query result: 262339 48 | LP result: 217679.58333333334 49 | -------------------------------------------------------------------------------- /Script/CollectResultsLSGS.py: -------------------------------------------------------------------------------- 1 | import math 2 | import os 3 | import sys 4 | 5 | repeat_times = 10 6 | 7 | epsilons = [0.8] 8 | queries = ["Q3", "Q12", "Q20"] 9 | scale = "_3" 10 | 11 | def main(argv): 12 | GS = 10000.0 13 | 14 | for query in queries: 15 | cur_path = os.getcwd() 16 | 17 | output_file = open(cur_path + "/../Result/TPCH/LS_" + query + "_GS.txt", 'w') 18 | 19 | for pow_ in range(8): 20 | for epsilon in epsilons: 21 | errors = [] 22 | 23 | cmd = "python " + cur_path + "/../Code/LS.py -I " + cur_path + "/../Information/TPCH/" + query + scale + ".txt -e " + str(epsilon) + " -G " + str(int(GS)) 24 | 25 | for i in range(repeat_times): 26 | shell = os.popen(cmd, 'r') 27 | res = shell.read() 28 | res = res.split() 29 | 30 | a = float(res[2]) 31 | b = float(res[5]) 32 | 33 | errors.append(abs(a - b)) 34 | 35 | errors.sort() 36 | 37 | output_file.write(str(GS) + " " + str(sum(errors[int(repeat_times * 0.2) : int(repeat_times * 0.8)]) / int(repeat_times * 0.6)) + "\n") 38 | 39 | GS *= 10 40 | 41 | if __name__ == "__main__": 42 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_rectangle_RoadnetPA.txt: -------------------------------------------------------------------------------- 1 | 4096 2 | Time: 2.254449446996053 3 | Query result: 157802 4 | LP result: 157802.0 5 | 2048.0 6 | Time: 2.45767871538798 7 | Query result: 157802 8 | LP result: 157802.0 9 | 1024.0 10 | Time: 2.3950329621632895 11 | Query result: 157802 12 | LP result: 157802.0 13 | 512.0 14 | Time: 2.3208398818969727 15 | Query result: 157802 16 | LP result: 157802.0 17 | 256.0 18 | Time: 2.420642534891764 19 | Query result: 157802 20 | LP result: 157802.0 21 | 128.0 22 | Time: 2.4389983812967935 23 | Query result: 157802 24 | LP result: 157802.0 25 | 64.0 26 | Time: 2.3409815629323325 27 | Query result: 157802 28 | LP result: 157802.0 29 | 32.0 30 | Time: 2.4307947158813477 31 | Query result: 157802 32 | LP result: 157802.0 33 | 16.0 34 | Time: 2.4124037424723306 35 | Query result: 157802 36 | LP result: 157802.0 37 | 8.0 38 | Time: 2.592921257019043 39 | Query result: 157802 40 | LP result: 157801.0 41 | 4.0 42 | Time: 2.3221070766448975 43 | Query result: 157802 44 | LP result: 157647.66666666666 45 | 2.0 46 | Time: 3.484559933344523 47 | Query result: 157802 48 | LP result: 129816.16666666666 49 | -------------------------------------------------------------------------------- /Script/CollectExtractInfoTimeGraph.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import time 4 | 5 | repeat_times = 10 6 | queries = ["one_path", "triangle", "two_path", "rectangle"] 7 | databases = ["Amazon2", "Amazon1", "RoadnetPA", "RoadnetCA", "Deezer"] 8 | 9 | def main(argv): 10 | cur_path = os.getcwd() 11 | 12 | output_file = open(cur_path + "/../Result/Graph/ExtractInfoTimeGraph.txt", 'w') 13 | 14 | for database in databases: 15 | for query in queries: 16 | sum_time = 0 17 | 18 | for i in range(repeat_times): 19 | start = time.time() 20 | 21 | cmd = "python " + cur_path + "/../Code/ExtractInfo.py -D " + database + " -Q " + cur_path + "/../Query/" + query + ".txt -K " + cur_path + "/../Query/" + query + "_key.txt -P node -O " + cur_path + "/../Temp/aaa.txt" 22 | 23 | shell = os.popen(cmd, 'r') 24 | shell.read() 25 | shell.close() 26 | 27 | end = time.time() 28 | 29 | sum_time += end - start 30 | 31 | output_file.write(database + " " + query + " " + str(sum_time/repeat_times) + "\n") 32 | 33 | os.remove(cur_path + "/../Temp/aaa.txt") 34 | 35 | if __name__ == "__main__": 36 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_two_path_Deezer.txt: -------------------------------------------------------------------------------- 1 | 1048576 2 | Time: 208.86493023236594 3 | Query result: 21820149 4 | LP result: 21820149.0 5 | 524288.0 6 | Time: 165.49812078475952 7 | Query result: 21820149 8 | LP result: 21820149.0 9 | 262144.0 10 | Time: 172.96576698621115 11 | Query result: 21820149 12 | LP result: 21820149.0 13 | 131072.0 14 | Time: 176.40525873502096 15 | Query result: 21820149 16 | LP result: 21820149.0 17 | 65536.0 18 | Time: 183.6397103468577 19 | Query result: 21820149 20 | LP result: 21753557.0 21 | 32768.0 22 | Time: 212.96019275983176 23 | Query result: 21820149 24 | LP result: 21599707.0 25 | 16384.0 26 | Time: 238.55566755930582 27 | Query result: 21820149 28 | LP result: 21192136.0 29 | 8192.0 30 | Time: 240.13776087760925 31 | Query result: 21820149 32 | LP result: 20182285.0 33 | 4096.0 34 | Time: 283.593790769577 35 | Query result: 21820149 36 | LP result: 18334497.5 37 | 2048.0 38 | Time: 711.6675716241201 39 | Query result: 21820149 40 | LP result: 15673474.214288237 41 | 1024.0 42 | Time: 2071.909695227941 43 | Query result: 21820149 44 | LP result: 12444750.264929798 45 | 512.0 46 | Time: 3895.497454325358 47 | Query result: 21820149 48 | LP result: 9069998.030120116 49 | 256.0 50 | Time: 19202.89490358035 51 | Query result: 21820149 52 | LP result: 6183029.360835945 53 | -------------------------------------------------------------------------------- /Script/CollectResultsLS.py: -------------------------------------------------------------------------------- 1 | import math 2 | import os 3 | import sys 4 | 5 | repeat_times = 30 6 | 7 | epsilons = [0.1, 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, 12.8] 8 | queries = [("Q3", 2888656), ("Q12", 6001215), ("Q20", 6001215)] 9 | scales = ["_3"] 10 | 11 | GS = 1000000.0 12 | 13 | def main(argv): 14 | for (query, real_ans) in queries: 15 | cur_path = os.getcwd() 16 | 17 | output_file = open(cur_path + "/../Result/TPCH/LS_" + query + ".txt", 'w') 18 | 19 | for scale in scales: 20 | for epsilon in epsilons: 21 | sum_time = 0 22 | errors = [] 23 | 24 | cmd = "python " + cur_path + "/../Code/LS.py -I " + cur_path + "/../Information/TPCH/" + query + scale + ".txt -e " + str(epsilon) + " -G " + str(int(GS)) 25 | 26 | for i in range(repeat_times): 27 | shell = os.popen(cmd, 'r') 28 | res = shell.read() 29 | res = res.split() 30 | 31 | a = float(res[2]) 32 | b = float(res[5]) 33 | c = float(res[7]) 34 | 35 | errors.append(abs(a - b)) 36 | sum_time += c 37 | 38 | errors.sort() 39 | 40 | output_file.write(str(epsilon) + " " + str(real_ans) + " " + str(sum(errors[int(repeat_times * 0.2) : int(repeat_times * 0.8)]) / int(repeat_times * 0.6)) + " " + str(sum_time/repeat_times) + "\n") 41 | 42 | if __name__ == "__main__": 43 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /Script/CollectResultsTPCHGS.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import sys 3 | import os 4 | 5 | 6 | 7 | def main(argv): 8 | Q = [3,12,20] 9 | GS_L = [10000,10000,10000] 10 | repeat_time = 10 11 | cur_path=os.getcwd() 12 | for i in range(len(Q)): 13 | output_file = cur_path+"/../Result/TPCH/R2T_Q"+str(Q[i])+"_GS.txt" 14 | output = open(output_file, 'w') 15 | for j in range(8): 16 | print(str(i)+" "+str(j)) 17 | GS = GS_L[i]*pow(10,j) 18 | results = [] 19 | cmd = "python "+cur_path+"/../Code/R2TSJF.py -I "+cur_path+"/../Information/TPCH/Q"+str(Q[i])+"_3.txt -b 0.1 -e 0.8 -G "+str(GS) 20 | for k in range(repeat_time): 21 | shell = os.popen(cmd, 'r') 22 | res = shell.read() 23 | res = res.split() 24 | a = float(res[2]) 25 | b = float(res[5]) 26 | results.append(abs(a-b)) 27 | shell.close() 28 | results.sort() 29 | res = sum(results)-results[0]-results[1]-results[repeat_time-1]-results[repeat_time-2] 30 | res = res/(repeat_time-4) 31 | output.write(str(GS)+" "+str(res)+"\n") 32 | output.close() 33 | 34 | 35 | 36 | if __name__ == "__main__": 37 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /Script/CollectResultsLSScalability.py: -------------------------------------------------------------------------------- 1 | import math 2 | import os 3 | import sys 4 | 5 | repeat_times = 30 6 | 7 | epsilons = [0.8] 8 | queries = ["Q3", "Q12", "Q20"] 9 | scales = ["_0", "_1", "_2", "_3", "_4", "_5", "_6"] 10 | 11 | GS = 1000000.0 12 | 13 | def main(argv): 14 | for query in queries: 15 | cur_path = os.getcwd() 16 | 17 | output_file = open(cur_path + "/../Result/TPCH/LS_" + query + "_Scalability.txt", 'w') 18 | 19 | for l_scale in range(len(scales)): 20 | scale = scales[l_scale] 21 | 22 | for epsilon in epsilons: 23 | real_ans = 0 24 | sum_time = 0 25 | errors = [] 26 | 27 | cur_path = os.getcwd() 28 | cmd = "python " + cur_path + "/../Code/LS.py -I " + cur_path + "/../Information/TPCH/" + query + scale + ".txt -e " + str(epsilon) + " -G " + str(int(GS)) 29 | 30 | for i in range(repeat_times): 31 | shell = os.popen(cmd, 'r') 32 | res = shell.read() 33 | res = res.split() 34 | 35 | a = float(res[2]) 36 | b = float(res[5]) 37 | c = float(res[7]) 38 | 39 | real_ans = int(a) 40 | errors.append(abs(a - b)) 41 | sum_time += c 42 | 43 | errors.sort() 44 | 45 | output_file.write(str(math.pow(2, l_scale - 3)) + " " + str(real_ans) + " " + str(sum(errors[int(repeat_times * 0.2) : int(repeat_times * 0.8)]) / int(repeat_times * 0.6)) + " " + str(sum_time/repeat_times) + "\n") 46 | 47 | if __name__ == "__main__": 48 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_two_path_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 1048576 2 | Time: 97.63679663340251 3 | Query result: 9120350 4 | LP result: 9120350.0 5 | 524288.0 6 | Time: 97.6687463124593 7 | Query result: 9120350 8 | LP result: 9120350.0 9 | 262144.0 10 | Time: 83.24000970522563 11 | Query result: 9120350 12 | LP result: 9120350.0 13 | 131072.0 14 | Time: 82.10482708613078 15 | Query result: 9120350 16 | LP result: 9120350.0 17 | 65536.0 18 | Time: 95.94789505004883 19 | Query result: 9120350 20 | LP result: 9069260.0 21 | 32768.0 22 | Time: 78.37621490160625 23 | Query result: 9120350 24 | LP result: 8883877.0 25 | 16384.0 26 | Time: 79.56607874234517 27 | Query result: 9120350 28 | LP result: 8674803.0 29 | 8192.0 30 | Time: 90.79318531354268 31 | Query result: 9120350 32 | LP result: 8401853.0 33 | 4096.0 34 | Time: 78.62049738566081 35 | Query result: 9120350 36 | LP result: 8084541.0 37 | 2048.0 38 | Time: 87.28146576881409 39 | Query result: 9120350 40 | LP result: 7676322.0 41 | 1024.0 42 | Time: 102.37226708730061 43 | Query result: 9120350 44 | LP result: 7166601.0 45 | 512.0 46 | Time: 100.45950078964233 47 | Query result: 9120350 48 | LP result: 6553961.5 49 | 256.0 50 | Time: 131.02686850229898 51 | Query result: 9120350 52 | LP result: 5781542.5 53 | 128.0 54 | Time: 207.4089306195577 55 | Query result: 9120350 56 | LP result: 4808670.000000015 57 | 64.0 58 | Time: 354.62858335177106 59 | Query result: 9120350 60 | LP result: 3640755.8880959894 61 | 32.0 62 | Time: 1571.7186819712322 63 | Query result: 9120350 64 | LP result: 2450320.79335097 65 | -------------------------------------------------------------------------------- /Script/CollectExtractInfoTimeTPCH.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import sys 3 | import os 4 | import time 5 | 6 | 7 | 8 | def main(argv): 9 | Q = [5,8,21,3,12,20,10,7,11,18] 10 | P = ["ids","ids","ids","customer","orders","supplier","customer","ids","supplier","customer"] 11 | DB = ["sc","sc","so","sc","sc","sc","sc","sc","sc","sc"] 12 | S = ["0","1","2","3","4","5","6","7"] 13 | cur_path=os.getcwd() 14 | repeat_time = 10 15 | times = [] 16 | for i in range(len(S)): 17 | time_i = [] 18 | for j in range(len(Q)): 19 | time_i_j = 0.0 20 | for k in range(repeat_time): 21 | print(str(i)+" "+str(j)+" "+str(k)) 22 | start = time.time() 23 | cmd = "python "+cur_path+"/../Code/ExtractInfo.py -D "+DB[j]+"_"+S[i]+" -Q "+cur_path+"/../Query/Q"+str(Q[j])+".txt -K "+cur_path+"/../Query/Q"+str(Q[j]) 24 | cmd = cmd+"_key.txt -P "+P[j]+" -O "+cur_path+"/../Temp/temp.txt" 25 | shell = os.popen(cmd, 'r') 26 | shell.read() 27 | shell.close() 28 | end= time.time() 29 | time_i_j+=end-start 30 | cmd = "rm "+cur_path+"/../Temp/temp.txt" 31 | shell = os.popen(cmd, 'r') 32 | shell.read() 33 | shell.close() 34 | time_i_j /= repeat_time 35 | time_i.append(time_i_j) 36 | times.append(time_i) 37 | output_file = cur_path+"/../Result/TPCH/ExtractInfoTimeTPCH.txt" 38 | results = open(output_file, 'w') 39 | for i in range(len(S)): 40 | for j in range(len(Q)): 41 | results.write(S[i]+" Q"+str(Q[j])+" "+str(times[i][j])+"\n") 42 | 43 | 44 | 45 | if __name__ == "__main__": 46 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /Script/CollectQueryTimeTPCH.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import sys 3 | import os 4 | import psycopg2 5 | import time 6 | 7 | 8 | def main(argv): 9 | Q = [5,8,21,3,12,20,10,7,11,18] 10 | S = ["0","1","2","3","4","5","6"] 11 | DB = ["sc","sc","so","sc","sc","sc","sc","sc","sc","sc"] 12 | cur_path=os.getcwd() 13 | repeat_time = 10 14 | times = [] 15 | for i in range(len(S)): 16 | time_i = [] 17 | for j in range(len(Q)): 18 | time_i_j = 0.0 19 | con = psycopg2.connect(database=DB[j]+"_"+S[i]) 20 | cur = con.cursor() 21 | query_path = cur_path+"/../Query/Q"+str(Q[j])+".txt" 22 | query = "" 23 | query_file = open(query_path,'r') 24 | # Read the query file and store in query 25 | for line in query_file.readlines(): 26 | query = query + line 27 | if ";" in query: 28 | query = query.replace('\n'," ") 29 | break 30 | for k in range(repeat_time): 31 | print(str(i)+" "+str(j)+" "+str(k)) 32 | start = time.time() 33 | cur.execute(query) 34 | cur.fetchall() 35 | end= time.time() 36 | time_i_j+=end-start 37 | time_i_j /= repeat_time 38 | time_i.append(time_i_j) 39 | con.commit() 40 | con.close() 41 | times.append(time_i) 42 | output_file = cur_path+"/../Result/TPCH/QueryTimeTPCH.txt" 43 | results = open(output_file, 'w') 44 | for i in range(len(S)): 45 | for j in range(len(Q)): 46 | results.write(S[i]+" Q"+str(Q[j])+" "+str(times[i][j])+"\n") 47 | 48 | 49 | 50 | if __name__ == "__main__": 51 | main(sys.argv[1:]) 52 | 53 | 54 | -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_triangle_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 1048576 2 | Time: 7.312917232513428 3 | Query result: 717719 4 | LP result: 717719.0 5 | 524288.0 6 | Time: 7.394951184590657 7 | Query result: 717719 8 | LP result: 717719.0 9 | 262144.0 10 | Time: 7.800336758295695 11 | Query result: 717719 12 | LP result: 717719.0 13 | 131072.0 14 | Time: 7.665731588999431 15 | Query result: 717719 16 | LP result: 717719.0 17 | 65536.0 18 | Time: 7.791251341501872 19 | Query result: 717719 20 | LP result: 717719.0 21 | 32768.0 22 | Time: 8.304497480392456 23 | Query result: 717719 24 | LP result: 717719.0 25 | 16384.0 26 | Time: 8.96155595779419 27 | Query result: 717719 28 | LP result: 717719.0 29 | 8192.0 30 | Time: 8.182039101918539 31 | Query result: 717719 32 | LP result: 717719.0 33 | 4096.0 34 | Time: 8.353212912877401 35 | Query result: 717719 36 | LP result: 717719.0 37 | 2048.0 38 | Time: 8.501372416814169 39 | Query result: 717719 40 | LP result: 717719.0 41 | 1024.0 42 | Time: 9.354313691457113 43 | Query result: 717719 44 | LP result: 717719.0 45 | 512.0 46 | Time: 8.212742805480957 47 | Query result: 717719 48 | LP result: 717711.0 49 | 256.0 50 | Time: 8.530365864435831 51 | Query result: 717719 52 | LP result: 716620.0 53 | 128.0 54 | Time: 8.061258633931478 55 | Query result: 717719 56 | LP result: 712613.0 57 | 64.0 58 | Time: 8.097507874170939 59 | Query result: 717719 60 | LP result: 700065.0 61 | 32.0 62 | Time: 8.210239013036093 63 | Query result: 717719 64 | LP result: 664488.3333333329 65 | 16.0 66 | Time: 10.670852502187094 67 | Query result: 717719 68 | LP result: 568935.1999999852 69 | 8.0 70 | Time: 17.364494959513348 71 | Query result: 717719 72 | LP result: 413902.923809524 73 | 4.0 74 | Time: 30.306904792785645 75 | Query result: 717719 76 | LP result: 258036.9960236985 77 | 2.0 78 | Time: 32.11361916859945 79 | Query result: 717719 80 | LP result: 143715.18875360652 81 | -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_triangle_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 1048576 2 | Time: 7.349090655644734 3 | Query result: 667129 4 | LP result: 667129.0 5 | 524288.0 6 | Time: 6.8220283190409345 7 | Query result: 667129 8 | LP result: 667129.0 9 | 262144.0 10 | Time: 7.002451737721761 11 | Query result: 667129 12 | LP result: 667129.0 13 | 131072.0 14 | Time: 7.587117115656535 15 | Query result: 667129 16 | LP result: 667129.0 17 | 65536.0 18 | Time: 7.537424325942993 19 | Query result: 667129 20 | LP result: 667129.0 21 | 32768.0 22 | Time: 7.359223127365112 23 | Query result: 667129 24 | LP result: 667129.0 25 | 16384.0 26 | Time: 8.900792042414347 27 | Query result: 667129 28 | LP result: 667129.0 29 | 8192.0 30 | Time: 7.2513759930928545 31 | Query result: 667129 32 | LP result: 667129.0 33 | 4096.0 34 | Time: 9.00539747873942 35 | Query result: 667129 36 | LP result: 667129.0 37 | 2048.0 38 | Time: 8.17935053507487 39 | Query result: 667129 40 | LP result: 667129.0 41 | 1024.0 42 | Time: 8.738418420155844 43 | Query result: 667129 44 | LP result: 667129.0 45 | 512.0 46 | Time: 8.324191252390543 47 | Query result: 667129 48 | LP result: 667090.0 49 | 256.0 50 | Time: 7.301867485046387 51 | Query result: 667129 52 | LP result: 665109.0 53 | 128.0 54 | Time: 8.1755002339681 55 | Query result: 667129 56 | LP result: 658765.0 57 | 64.0 58 | Time: 8.856884717941284 59 | Query result: 667129 60 | LP result: 635671.833333333 61 | 32.0 62 | Time: 7.863649845123291 63 | Query result: 667129 64 | LP result: 574799.8333333329 65 | 16.0 66 | Time: 10.402146259943644 67 | Query result: 667129 68 | LP result: 463938.05 69 | 8.0 70 | Time: 13.056520303090414 71 | Query result: 667129 72 | LP result: 329292.1587301588 73 | 4.0 74 | Time: 22.861738681793213 75 | Query result: 667129 76 | LP result: 208250.4307539683 77 | 2.0 78 | Time: 23.565328518549602 79 | Query result: 667129 80 | LP result: 119712.53264790899 81 | -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_triangle_Deezer.txt: -------------------------------------------------------------------------------- 1 | 1048576 2 | Time: 6.9388197263081866 3 | Query result: 794210 4 | LP result: 794210.0 5 | 524288.0 6 | Time: 6.863529284795125 7 | Query result: 794210 8 | LP result: 794210.0 9 | 262144.0 10 | Time: 7.128342707951863 11 | Query result: 794210 12 | LP result: 794210.0 13 | 131072.0 14 | Time: 6.7006815274556475 15 | Query result: 794210 16 | LP result: 794210.0 17 | 65536.0 18 | Time: 7.098037878672282 19 | Query result: 794210 20 | LP result: 794210.0 21 | 32768.0 22 | Time: 6.88166872660319 23 | Query result: 794210 24 | LP result: 794210.0 25 | 16384.0 26 | Time: 7.977924664815267 27 | Query result: 794210 28 | LP result: 794210.0 29 | 8192.0 30 | Time: 7.371483167012532 31 | Query result: 794210 32 | LP result: 794210.0 33 | 4096.0 34 | Time: 7.458453734715779 35 | Query result: 794210 36 | LP result: 794210.0 37 | 2048.0 38 | Time: 8.203845898310343 39 | Query result: 794210 40 | LP result: 794210.0 41 | 1024.0 42 | Time: 7.424130121866862 43 | Query result: 794210 44 | LP result: 792609.0 45 | 512.0 46 | Time: 8.15449857711792 47 | Query result: 794210 48 | LP result: 773157.0 49 | 256.0 50 | Time: 9.314925988515219 51 | Query result: 794210 52 | LP result: 715046.0833333568 53 | 128.0 54 | Time: 10.936311801274618 55 | Query result: 794210 56 | LP result: 611940.9529030805 57 | 64.0 58 | Time: 17.480540990829468 59 | Query result: 794210 60 | LP result: 483752.74232458195 61 | 32.0 62 | Time: 32.552414894104004 63 | Query result: 794210 64 | LP result: 355708.90888878226 65 | 16.0 66 | Time: 69.29223004976909 67 | Query result: 794210 68 | LP result: 244293.78227667738 69 | 8.0 70 | Time: 206.0483173529307 71 | Query result: 794210 72 | LP result: 157268.6828654968 73 | 4.0 74 | Time: 691.5615243911743 75 | Query result: 794210 76 | LP result: 94732.51408411977 77 | 2.0 78 | Time: 1372.4285991191864 79 | Query result: 794210 80 | LP result: 53662.63392965653 81 | -------------------------------------------------------------------------------- /Script/CollectResultsRM.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import os 3 | import sys 4 | import getopt 5 | 6 | 7 | 8 | def main(argv): 9 | Q = ["one_path","triangle","two_path", "rectangle"] 10 | Data = ["Amazon2","Amazon1","RoadnetPA","RoadnetCA","Deezer"] 11 | eps = 0.1 12 | i = 0; 13 | j = 0 14 | try: 15 | opts, args = getopt.getopt(argv,"h:Q:D:e:",["QueryId=","DataId=","Epsilon="]) 16 | except getopt.GetoptError: 17 | print("CollectResultsRM.py -Q -D -e ") 18 | sys.exit(2) 19 | for opt, arg in opts: 20 | if opt == '-h': 21 | print("CollectResultsRM.py -Q -D -e ") 22 | sys.exit() 23 | elif opt in ("-Q", "--QueryId"): 24 | j = int(arg) 25 | elif opt in ("-D", "--DataId"): 26 | i = int(arg) 27 | elif opt in ("-e", "--Epsilon"): 28 | eps = float(arg) 29 | cur_path=os.getcwd() 30 | cmd = "python "+cur_path+"/../Code/RM.py -e "+str(eps)+" -d 0.1 -I "+cur_path+"/../Information/Graph/"+Q[j]+"/"+Data[i]+".txt" 31 | result = [] 32 | time = 0 33 | for i in range(10): 34 | shell = os.popen(cmd, 'r') 35 | res = shell.read() 36 | res = res.split() 37 | a = float(res[2]) 38 | b = float(res[5]) 39 | c = float(res[7]) 40 | result.append(abs(a-b)) 41 | time+=c 42 | result.sort() 43 | res = sum(result)-result[0]-result[1]-result[10-1]-result[10-2] 44 | res = res/6 45 | time = time/10 46 | print("Error") 47 | print(res) 48 | print("Time") 49 | print(time) 50 | 51 | 52 | 53 | if __name__ == "__main__": 54 | main(sys.argv[1:]) 55 | -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_two_path_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 1048576 2 | Time: 104.58337020874023 3 | Query result: 9752186 4 | LP result: 9752186.0 5 | 524288.0 6 | Time: 104.77012578646342 7 | Query result: 9752186 8 | LP result: 9752186.0 9 | 262144.0 10 | Time: 92.90563829739888 11 | Query result: 9752186 12 | LP result: 9752186.0 13 | 131072.0 14 | Time: 93.31501547495525 15 | Query result: 9752186 16 | LP result: 9731388.0 17 | 65536.0 18 | Time: 96.49916219711304 19 | Query result: 9752186 20 | LP result: 9665852.0 21 | 32768.0 22 | Time: 87.12097231547038 23 | Query result: 9752186 24 | LP result: 9610216.0 25 | 16384.0 26 | Time: 95.33089764912923 27 | Query result: 9752186 28 | LP result: 9492064.0 29 | 8192.0 30 | Time: 87.91657988230388 31 | Query result: 9752186 32 | LP result: 9281827.0 33 | 4096.0 34 | Time: 89.73719914754231 35 | Query result: 9752186 36 | LP result: 8954622.5 37 | 2048.0 38 | Time: 114.20446801185608 39 | Query result: 9752186 40 | LP result: 8490400.0 41 | 1024.0 42 | Time: 111.54726696014404 43 | Query result: 9752186 44 | LP result: 7812698.5 45 | 512.0 46 | Time: 136.42646861076355 47 | Query result: 9752186 48 | LP result: 6911289.166666608 49 | 256.0 50 | Time: 147.80543581644693 51 | Query result: 9752186 52 | LP result: 5805952.8333333 53 | 128.0 54 | Time: 210.79237206776938 55 | Query result: 9752186 56 | LP result: 4553679.916666726 57 | 64.0 58 | Time: 412.1245935757955 59 | Query result: 9752186 60 | LP result: 3284678.648810456 61 | 32.0 62 | Time: 640.9330070018768 63 | Query result: 9752186 64 | LP result: 2176166.847607333 65 | 16.0 66 | Time: 699.7999668916067 67 | Query result: 9752186 68 | LP result: 1328704.3016730207 69 | 8.0 70 | Time: 1342.6643052895863 71 | Query result: 9752186 72 | LP result: 756304.7725330928 73 | 4.0 74 | Time: 1774.7099324067433 75 | Query result: 9752186 76 | LP result: 407273.98606118275 77 | 2.0 78 | Time: 1991.8834733963013 79 | Query result: 9752186 80 | LP result: 210980.99940492387 81 | -------------------------------------------------------------------------------- /Result/TPCH/ExtractInfoTimeTPCH.txt: -------------------------------------------------------------------------------- 1 | 0 Q5 0.49657788276672366 2 | 0 Q8 1.3709303140640259 3 | 0 Q21 3.156657838821411 4 | 0 Q3 1.4697705268859864 5 | 0 Q12 1.8040972471237182 6 | 0 Q20 2.086182141304016 7 | 0 Q10 0.687564206123352 8 | 0 Q7 3.8363614797592165 9 | 0 Q11 0.5328198432922363 10 | 0 Q18 2.5628968238830567 11 | 1 Q5 0.8342018842697143 12 | 1 Q8 2.3769445180892945 13 | 1 Q21 6.33532567024231 14 | 1 Q3 2.6050469398498537 15 | 1 Q12 3.4737792015075684 16 | 1 Q20 3.7397683382034304 17 | 1 Q10 1.1918158054351806 18 | 1 Q7 7.619399237632751 19 | 1 Q11 0.8588785648345947 20 | 1 Q18 5.087347555160522 21 | 2 Q5 1.7032119274139403 22 | 2 Q8 4.660785269737244 23 | 2 Q21 12.837536334991455 24 | 2 Q3 5.088201403617859 25 | 2 Q12 7.04291033744812 26 | 2 Q20 9.103951001167298 27 | 2 Q10 3.2080058097839355 28 | 2 Q7 23.84738733768463 29 | 2 Q11 2.087824845314026 30 | 2 Q18 16.24680140018463 31 | 3 Q5 5.725901412963867 32 | 3 Q8 14.785287070274354 33 | 3 Q21 40.89962260723114 34 | 3 Q3 15.912710046768188 35 | 3 Q12 20.522253727912904 36 | 3 Q20 19.546349930763245 37 | 3 Q10 7.098564767837525 38 | 3 Q7 48.463364934921266 39 | 3 Q11 3.642851400375366 40 | 3 Q18 36.38329641819 41 | 4 Q5 8.394258117675781 42 | 4 Q8 23.89059135913849 43 | 4 Q21 105.0334412097931 44 | 4 Q3 40.908585166931154 45 | 4 Q12 50.78827617168427 46 | 4 Q20 53.47161195278168 47 | 4 Q10 17.269957494735717 48 | 4 Q7 82.90817108154297 49 | 4 Q11 6.18303964138031 50 | 4 Q18 50.81331233978271 51 | 5 Q5 17.217832612991334 52 | 5 Q8 46.267704892158505 53 | 5 Q21 122.0069333076477 54 | 5 Q3 42.30281279087067 55 | 5 Q12 66.00933721065522 56 | 5 Q20 66.6581048488617 57 | 5 Q10 21.258435583114625 58 | 5 Q7 148.81655123233796 59 | 5 Q11 13.213375401496886 60 | 5 Q18 98.63868384361267 61 | 6 Q5 31.86868212223053 62 | 6 Q8 86.56251785755157 63 | 6 Q21 248.85506122112275 64 | 6 Q3 86.47963316440583 65 | 6 Q12 133.15167706012727 66 | 6 Q20 131.1019535303116 67 | 6 Q10 43.744792103767395 68 | 6 Q7 302.19199459552766 69 | 6 Q11 26.064463424682618 70 | 6 Q18 210.15269289016723 71 | -------------------------------------------------------------------------------- /Result/TPCH/QueryTimeTPCH.txt: -------------------------------------------------------------------------------- 1 | 0 Q5 0.26322641372680666 2 | 0 Q8 0.17284975051879883 3 | 0 Q21 0.2628733396530151 4 | 0 Q3 0.17430639266967773 5 | 0 Q12 0.08507761955261231 6 | 0 Q20 0.15036137104034425 7 | 0 Q10 0.03718609809875488 8 | 0 Q7 0.36017732620239257 9 | 0 Q11 0.044495892524719236 10 | 0 Q18 0.22173457145690917 11 | 1 Q5 0.5337828874588013 12 | 1 Q8 0.332764720916748 13 | 1 Q21 0.6799532413482666 14 | 1 Q3 0.3696277141571045 15 | 1 Q12 0.17112081050872802 16 | 1 Q20 0.31331791877746584 17 | 1 Q10 0.08324704170227051 18 | 1 Q7 0.7461192607879639 19 | 1 Q11 0.06664204597473145 20 | 1 Q18 0.46022446155548097 21 | 2 Q5 1.1641561031341552 22 | 2 Q8 0.6909470081329345 23 | 2 Q21 1.129869532585144 24 | 2 Q3 0.7827986478805542 25 | 2 Q12 0.5935158967971802 26 | 2 Q20 0.6395116567611694 27 | 2 Q10 0.15568392276763915 28 | 2 Q7 1.5623709201812743 29 | 2 Q11 0.14420981407165528 30 | 2 Q18 1.01303870677948 31 | 3 Q5 2.512066626548767 32 | 3 Q8 1.4102629661560058 33 | 3 Q21 2.323044490814209 34 | 3 Q3 1.5974257469177247 35 | 3 Q12 1.242540431022644 36 | 3 Q20 1.2473825931549072 37 | 3 Q10 0.320108962059021 38 | 3 Q7 3.22450737953186 39 | 3 Q11 0.2944517135620117 40 | 3 Q18 2.2056429624557494 41 | 4 Q5 5.287268924713135 42 | 4 Q8 3.285632276535034 43 | 4 Q21 4.950185966491699 44 | 4 Q3 3.4194130420684816 45 | 4 Q12 2.6602538585662843 46 | 4 Q20 2.4343437433242796 47 | 4 Q10 0.6053369760513305 48 | 4 Q7 6.795520973205567 49 | 4 Q11 0.5665578603744507 50 | 4 Q18 4.729692482948304 51 | 5 Q5 11.115621995925903 52 | 5 Q8 6.914611148834228 53 | 5 Q21 10.033325934410096 54 | 5 Q3 6.923236298561096 55 | 5 Q12 4.737350249290467 56 | 5 Q20 4.943952965736389 57 | 5 Q10 1.3456936359405518 58 | 5 Q7 12.910286450386048 59 | 5 Q11 1.0623404502868652 60 | 5 Q18 9.451964473724365 61 | 6 Q5 21.100085830688478 62 | 6 Q8 12.196340179443359 63 | 6 Q21 24.116886591911317 64 | 6 Q3 12.272677111625672 65 | 6 Q12 9.73159077167511 66 | 6 Q20 9.690556478500366 67 | 6 Q10 2.904116988182068 68 | 6 Q7 30.47293565273285 69 | 6 Q11 2.0999998092651366 70 | 6 Q18 18.95194983482361 71 | -------------------------------------------------------------------------------- /Script/ProcessGraphData.py: -------------------------------------------------------------------------------- 1 | import getopt 2 | import psycopg2 3 | import os 4 | import sys 5 | 6 | def main(argv): 7 | datasets = ["Amazon1", "Amazon2", "RoadnetPA", "RoadnetCA", "Deezer"] 8 | dataset = '' 9 | database_name = '' 10 | model = 0 11 | 12 | try: 13 | opts, args = getopt.getopt(argv,"h:d:D:m:",["dataset=","database=","model="]) 14 | except getopt.GetoptError: 15 | print("ProcessGraphData.py -d -D -m ") 16 | sys.exit(2) 17 | for opt, arg in opts: 18 | if opt == '-h': 19 | print("ProcessGraphData.py -d -D -m ") 20 | sys.exit() 21 | elif opt in ("-d", "--dataset"): 22 | dataset = arg 23 | elif opt in ("-D", "--Database"): 24 | database_name = arg 25 | elif opt in ("-m","--model"): 26 | model = int(arg) 27 | 28 | if model==0: 29 | if dataset not in datasets: 30 | print("Invalid dataset.") 31 | sys.exit() 32 | 33 | con = psycopg2.connect(database=database_name) 34 | cur = con.cursor() 35 | 36 | cur_path = os.getcwd() 37 | 38 | edge_file = open(cur_path+"/../Data/Graph/"+dataset+"_edges.txt", 'r') 39 | node_file = open(cur_path+"/../Data/Graph/"+dataset+"_nodes.txt", 'r') 40 | 41 | code = "CREATE TABLE NODE (ID INTEGER NOT NULL);" 42 | cur.execute(code) 43 | code = "CREATE TABLE EDGE (FROM_ID INTEGER NOT NULL, TO_ID INTEGER NOT NULL);" 44 | cur.execute(code) 45 | code = "CREATE INDEX on NODE using hash (ID);" 46 | cur.execute(code) 47 | code = "CREATE INDEX on EDGE using hash (FROM_ID);" 48 | cur.execute(code) 49 | code = "CREATE INDEX on EDGE using hash (TO_ID);" 50 | cur.execute(code) 51 | 52 | cur.copy_from(edge_file, 'EDGE', sep='|') 53 | cur.copy_from(node_file, 'NODE') 54 | 55 | con.commit() 56 | con.close() 57 | else: 58 | con = psycopg2.connect(database=database_name) 59 | cur = con.cursor() 60 | 61 | code = "drop table node;" 62 | cur.execute(code) 63 | code = "drop table edge;" 64 | cur.execute(code) 65 | 66 | con.commit() 67 | con.close() 68 | 69 | if __name__ == "__main__": 70 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /Script/CollectQueryTimeGraph.py: -------------------------------------------------------------------------------- 1 | import os 2 | import psycopg2 3 | import sys 4 | import time 5 | 6 | repeat_times = 10 7 | queries = ["one_path", "triangle", "two_path", "rectangle"] 8 | databases = ["Amazon2", "Amazon1", "RoadnetPA", "RoadnetCA", "Deezer"] 9 | 10 | def ExtractRelationship(database_name, query): 11 | con = psycopg2.connect(database=database_name) 12 | cur = con.cursor() 13 | 14 | cur.execute(query) 15 | 16 | con.commit() 17 | con.close() 18 | 19 | def main(argv): 20 | cur_path = os.getcwd() 21 | 22 | output_file = open(cur_path + "/../Result/Graph/QueryTimeGraph.txt", 'w') 23 | 24 | for database_name in databases: 25 | for query_type in range(len(queries)): 26 | query_name = queries[query_type] 27 | sum_time = 0 28 | 29 | for j in range(repeat_times): 30 | start = time.time() 31 | 32 | if query_type == 0: 33 | query = "select 1, r1.id, r2.id from node as r1, node as r2, edge where r1.id=edge.from_id and r2.id=edge.to_id and r1.id0.5: 14 | return b 15 | else: 16 | return -b 17 | 18 | 19 | def Process(i,j, cur_path): 20 | global Q 21 | global max_degree 22 | global q_pow 23 | global Data 24 | repeat_time = 100 25 | input_file_path = cur_path+"/../Result/Graph/LP_All_Tau_"+str(Q[j])+"_"+Data[i]+".txt" 26 | input_file = open(input_file_path, 'r') 27 | LP_res = {} 28 | res = 0 29 | lines = input_file.readlines() 30 | GS = pow(max_degree[i],q_pow[j]) 31 | ii = 0 32 | tau = GS 33 | num_line = len(lines) 34 | tau_list = [] 35 | while(tau>=2): 36 | tau_list.append(tau) 37 | if ii*4+3>num_line: 38 | LP_res[tau] = float(10000000000) 39 | tau/=2 40 | ii+=1 41 | continue 42 | l2 = lines[ii*4+2] 43 | l3 = lines[ii*4+3] 44 | elements = l2.split() 45 | res = float(elements[2]) 46 | elements = l3.split() 47 | LP_res[tau] = float(elements[2]) 48 | tau/=2 49 | ii+=1 50 | tau = GS 51 | for i in range(7): 52 | err = [] 53 | e = 0.8 54 | total_err = 0 55 | if tau<2: 56 | total_err =res- res/(q_pow[j]+1)*tau 57 | else: 58 | for i in range(repeat_time): 59 | err.append(abs(res-LP_res[tau]-LapNoise()*tau/e)/(repeat_time-int(repeat_time*0.4))) 60 | total_err = sum(err[int(repeat_time*0.2):repeat_time-int(repeat_time*0.2)]) 61 | tau/=8 62 | print(Q[j]+" "+str(tau)+" "+str(total_err)) 63 | 64 | 65 | 66 | def main(argv): 67 | global Q 68 | global max_degree 69 | global q_pow 70 | global Data 71 | cur_path=os.getcwd() 72 | Q = ["one_path","triangle","two_path", "rectangle"] 73 | Data = ["Amazon2","Amazon1","RoadnetPA","RoadnetCA","Deezer"] 74 | max_degree = [1024,1024,16,16,1024] 75 | q_pow = [1,2,2,3] 76 | for i in range(len(Data)): 77 | if i!=0: 78 | continue 79 | for j in range(len(Q)): 80 | Process(i,j, cur_path) 81 | 82 | 83 | 84 | if __name__ == "__main__": 85 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_rectangle_Deezer.txt: -------------------------------------------------------------------------------- 1 | 1073741824 2 | Time: 145.24231362342834 3 | Query result: 11866271 4 | LP result: 11866271.0 5 | 536870912.0 6 | Time: 133.40734386444092 7 | Query result: 11866271 8 | LP result: 11866271.0 9 | 268435456.0 10 | Time: 122.57794880867004 11 | Query result: 11866271 12 | LP result: 11866271.0 13 | 134217728.0 14 | Time: 135.17152873675028 15 | Query result: 11866271 16 | LP result: 11866271.0 17 | 67108864.0 18 | Time: 128.06084052721658 19 | Query result: 11866271 20 | LP result: 11866271.0 21 | 33554432.0 22 | Time: 119.13099487622578 23 | Query result: 11866271 24 | LP result: 11866271.0 25 | 16777216.0 26 | Time: 145.72829373677573 27 | Query result: 11866271 28 | LP result: 11866271.0 29 | 8388608.0 30 | Time: 164.57687719662985 31 | Query result: 11866271 32 | LP result: 11866271.0 33 | 4194304.0 34 | Time: 201.16967932383218 35 | Query result: 11866271 36 | LP result: 11866271.0 37 | 2097152.0 38 | Time: 150.73489705721536 39 | Query result: 11866271 40 | LP result: 11866271.0 41 | 1048576.0 42 | Time: 192.519402106603 43 | Query result: 11866271 44 | LP result: 11866271.0 45 | 524288.0 46 | Time: 190.18782337506613 47 | Query result: 11866271 48 | LP result: 11866271.0 49 | 262144.0 50 | Time: 250.1846732298533 51 | Query result: 11866271 52 | LP result: 11866271.0 53 | 131072.0 54 | Time: 256.7086919148763 55 | Query result: 11866271 56 | LP result: 11866271.0 57 | 65536.0 58 | Time: 253.1384800275167 59 | Query result: 11866271 60 | LP result: 11866271.0 61 | 32768.0 62 | Time: 282.0826810201009 63 | Query result: 11866271 64 | LP result: 11716885.0 65 | 16384.0 66 | Time: 237.63045676549277 67 | Query result: 11866271 68 | LP result: 11045600.0 69 | 8192.0 70 | Time: 234.94283016522726 71 | Query result: 11866271 72 | LP result: 9729100.772729807 73 | 4096.0 74 | Time: 447.9234224955241 75 | Query result: 11866271 76 | LP result: 7986215.520002261 77 | 2048.0 78 | Time: 676.990835348765 79 | Query result: 11866271 80 | LP result: 6084350.524319995 81 | 1024.0 82 | Time: 924.73352988561 83 | Query result: 11866271 84 | LP result: 4359019.356395544 85 | 512.0 86 | Time: 7481.7139936288195 87 | Query result: 11866271 88 | LP result: 2984970.768953801 89 | 256.0 90 | Time: 3751.2900820573172 91 | Query result: 11866271 92 | LP result: 1972589.230049027 93 | 128.0 94 | Time: 687.6084702809652 95 | Query result: 11866271 96 | LP result: 1262951.1492320646 97 | 64.0 98 | Time: 931.9081362088522 99 | Query result: 11866271 100 | LP result: 782490.4647342152 101 | 32.0 102 | Time: 1302.7460579872131 103 | Query result: 11866271 104 | LP result: 470259.1511293115 105 | 16.0 106 | Time: 1581.7317490577698 107 | Query result: 11866271 108 | LP result: 273643.9457296703 109 | 8.0 110 | Time: 5987.293935616811 111 | Query result: 11866271 112 | LP result: 154222.4630203048 113 | -------------------------------------------------------------------------------- /Code/LS.py: -------------------------------------------------------------------------------- 1 | import cplex 2 | import getopt 3 | import math 4 | import numpy as np 5 | import psycopg2 6 | import random 7 | import sys 8 | import time 9 | 10 | def ReadInput(): 11 | global input_file_path 12 | global size_dic 13 | global real_ans 14 | global max_degree 15 | 16 | size_dic = {} 17 | tuples = [] 18 | 19 | input_file = open(input_file_path,'r') 20 | 21 | for line in input_file.readlines(): 22 | elements = line.split() 23 | primary_id = int(elements[1]) 24 | 25 | if primary_id in size_dic.keys(): 26 | size_dic[primary_id] += 1 27 | else: 28 | size_dic[primary_id] = 1 29 | 30 | real_ans = sum(size_dic.values()) 31 | max_degree = max(size_dic.values()) 32 | 33 | def LapNoise(): 34 | a = random.uniform(0, 1) 35 | b = math.log(1 / (1 - a)) 36 | c = random.uniform(0, 1) 37 | 38 | if c > 0.5: 39 | return b 40 | else: 41 | return -b 42 | 43 | def QueryCount(i): 44 | global size_dic 45 | global real_ans 46 | global max_degree 47 | 48 | if i >= max_degree: 49 | return real_ans 50 | 51 | size_dic_i = dict((k, v) for k, v in size_dic.items() if v <= i) 52 | 53 | return sum(size_dic_i.values()) 54 | 55 | def Svt(): 56 | global epsilon_q_l 57 | global epsilon_svt 58 | global l 59 | 60 | q_l = QueryCount(l) 61 | q_hat_l = q_l + LapNoise() * l / epsilon_q_l 62 | 63 | t = 0 64 | t_hat = t + LapNoise() * 2 / epsilon_svt 65 | 66 | for i in range(1, l): 67 | q_i = QueryCount(i) 68 | v_i = LapNoise() * 4 / epsilon_svt 69 | 70 | if (q_i - q_hat_l) / i + v_i >= t_hat: 71 | return q_i, i 72 | 73 | return q_l, l 74 | 75 | def RunAlgorithm(): 76 | global epsilon_ans 77 | 78 | ans, tau = Svt() 79 | 80 | return ans + LapNoise() * tau / epsilon_ans 81 | 82 | def main(argv): 83 | global input_file_path 84 | global epsilon_q_l 85 | global epsilon_svt 86 | global epsilon_ans 87 | global l 88 | global real_ans 89 | 90 | try: 91 | opts, args = getopt.getopt(argv,"h:I:e:G:",["Input=","epsilon=","GS="]) 92 | except getopt.GetoptError: 93 | print("LS.py -I -e -G ") 94 | sys.exit(2) 95 | for opt, arg in opts: 96 | if opt == "-h": 97 | print("LS.py -I -e -G ") 98 | sys.exit() 99 | elif opt in ("-I", "--Input"): 100 | input_file_path = str(arg) 101 | elif opt in ("-e","--epsilon"): 102 | epsilon_q_l = float(arg) * 0.25 103 | epsilon_svt = float(arg) * 0.25 104 | epsilon_ans = float(arg) * 0.5 105 | elif opt in ("-G","--GS"): 106 | l = int(arg) 107 | 108 | start = time.time() 109 | 110 | ReadInput() 111 | 112 | res = RunAlgorithm() 113 | 114 | end= time.time() 115 | 116 | print("Query Result") 117 | print(real_ans) 118 | print("Noised Result") 119 | print(res) 120 | print("Time") 121 | print(end - start) 122 | 123 | if __name__ == "__main__": 124 | main(sys.argv[1:]) 125 | -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_rectangle_Amazon1.txt: -------------------------------------------------------------------------------- 1 | 1073741824 2 | Time: 32.30723738670349 3 | Query result: 2477087 4 | LP result: 2477087.0 5 | 536870912.0 6 | Time: 35.6677987575531 7 | Query result: 2477087 8 | LP result: 2477087.0 9 | 268435456.0 10 | Time: 36.0977033774058 11 | Query result: 2477087 12 | LP result: 2477087.0 13 | 134217728.0 14 | Time: 33.41609636942545 15 | Query result: 2477087 16 | LP result: 2477087.0 17 | 67108864.0 18 | Time: 39.58606632550558 19 | Query result: 2477087 20 | LP result: 2477087.0 21 | 33554432.0 22 | Time: 32.69644006093343 23 | Query result: 2477087 24 | LP result: 2477087.0 25 | 16777216.0 26 | Time: 31.801790952682495 27 | Query result: 2477087 28 | LP result: 2477087.0 29 | 8388608.0 30 | Time: 27.983309586842854 31 | Query result: 2477087 32 | LP result: 2477087.0 33 | 4194304.0 34 | Time: 27.08913056055705 35 | Query result: 2477087 36 | LP result: 2477087.0 37 | 2097152.0 38 | Time: 31.61795663833618 39 | Query result: 2477087 40 | LP result: 2477087.0 41 | 1048576.0 42 | Time: 28.74393916130066 43 | Query result: 2477087 44 | LP result: 2477087.0 45 | 524288.0 46 | Time: 32.4018931388855 47 | Query result: 2477087 48 | LP result: 2477087.0 49 | 262144.0 50 | Time: 27.186262607574463 51 | Query result: 2477087 52 | LP result: 2477087.0 53 | 131072.0 54 | Time: 35.09347804387411 55 | Query result: 2477087 56 | LP result: 2477087.0 57 | 65536.0 58 | Time: 34.656081438064575 59 | Query result: 2477087 60 | LP result: 2477087.0 61 | 32768.0 62 | Time: 29.192037502924602 63 | Query result: 2477087 64 | LP result: 2477087.0 65 | 16384.0 66 | Time: 29.64395308494568 67 | Query result: 2477087 68 | LP result: 2477087.0 69 | 8192.0 70 | Time: 28.841176748275757 71 | Query result: 2477087 72 | LP result: 2477087.0 73 | 4096.0 74 | Time: 26.66335662206014 75 | Query result: 2477087 76 | LP result: 2462744.0 77 | 2048.0 78 | Time: 30.080691973368328 79 | Query result: 2477087 80 | LP result: 2437125.0 81 | 1024.0 82 | Time: 30.938458681106567 83 | Query result: 2477087 84 | LP result: 2389783.25 85 | 512.0 86 | Time: 35.36245115598043 87 | Query result: 2477087 88 | LP result: 2309456.66666666 89 | 256.0 90 | Time: 29.62319262822469 91 | Query result: 2477087 92 | LP result: 2172590.766666651 93 | 128.0 94 | Time: 31.276854276657104 95 | Query result: 2477087 96 | LP result: 1925323.99999991 97 | 64.0 98 | Time: 36.402121464411415 99 | Query result: 2477087 100 | LP result: 1524415.62896783 101 | 32.0 102 | Time: 58.282426039377846 103 | Query result: 2477087 104 | LP result: 1066551.0156648292 105 | 16.0 106 | Time: 93.74161307017009 107 | Query result: 2477087 108 | LP result: 668925.6032700166 109 | 8.0 110 | Time: 112.9159767627716 111 | Query result: 2477087 112 | LP result: 386690.74305910926 113 | 4.0 114 | Time: 140.34073305130005 115 | Query result: 2477087 116 | LP result: 211088.3858646975 117 | 2.0 118 | Time: 172.7435817718506 119 | Query result: 2477087 120 | LP result: 110550.60190205458 121 | -------------------------------------------------------------------------------- /Result/Graph/LP_All_Tau_rectangle_Amazon2.txt: -------------------------------------------------------------------------------- 1 | 1073741824 2 | Time: 39.60350735982259 3 | Query result: 3125323 4 | LP result: 3125323.0 5 | 536870912.0 6 | Time: 44.93724226951599 7 | Query result: 3125323 8 | LP result: 3125323.0 9 | 268435456.0 10 | Time: 40.03591903050741 11 | Query result: 3125323 12 | LP result: 3125323.0 13 | 134217728.0 14 | Time: 47.8603580792745 15 | Query result: 3125323 16 | LP result: 3125323.0 17 | 67108864.0 18 | Time: 44.88129576047262 19 | Query result: 3125323 20 | LP result: 3125323.0 21 | 33554432.0 22 | Time: 39.479095141092934 23 | Query result: 3125323 24 | LP result: 3125323.0 25 | 16777216.0 26 | Time: 33.79391209284464 27 | Query result: 3125323 28 | LP result: 3125323.0 29 | 8388608.0 30 | Time: 39.013423204422 31 | Query result: 3125323 32 | LP result: 3125323.0 33 | 4194304.0 34 | Time: 35.78098432223002 35 | Query result: 3125323 36 | LP result: 3125323.0 37 | 2097152.0 38 | Time: 39.26670010884603 39 | Query result: 3125323 40 | LP result: 3125323.0 41 | 1048576.0 42 | Time: 36.93441232045492 43 | Query result: 3125323 44 | LP result: 3125323.0 45 | 524288.0 46 | Time: 46.21307921409607 47 | Query result: 3125323 48 | LP result: 3125323.0 49 | 262144.0 50 | Time: 38.20847495396932 51 | Query result: 3125323 52 | LP result: 3125323.0 53 | 131072.0 54 | Time: 35.60954968134562 55 | Query result: 3125323 56 | LP result: 3125323.0 57 | 65536.0 58 | Time: 33.83515818913778 59 | Query result: 3125323 60 | LP result: 3125323.0 61 | 32768.0 62 | Time: 37.531888008117676 63 | Query result: 3125323 64 | LP result: 3125323.0 65 | 16384.0 66 | Time: 45.1676352818807 67 | Query result: 3125323 68 | LP result: 3119076.0 69 | 8192.0 70 | Time: 35.55737455685934 71 | Query result: 3125323 72 | LP result: 3097257.0 73 | 4096.0 74 | Time: 36.19415783882141 75 | Query result: 3125323 76 | LP result: 3048666.0 77 | 2048.0 78 | Time: 36.460314194361366 79 | Query result: 3125323 80 | LP result: 2970698.5 81 | 1024.0 82 | Time: 37.14602931340536 83 | Query result: 3125323 84 | LP result: 2832040.9166667624 85 | 512.0 86 | Time: 39.169092416763306 87 | Query result: 3125323 88 | LP result: 2603234.5833333423 89 | 256.0 90 | Time: 54.7540713151296 91 | Query result: 3125323 92 | LP result: 2260318.816666368 93 | 128.0 94 | Time: 43.441894928614296 95 | Query result: 3125323 96 | LP result: 1810384.132286332 97 | 64.0 98 | Time: 66.67728002866109 99 | Query result: 3125323 100 | LP result: 1325304.4680281437 101 | 32.0 102 | Time: 84.52411381403606 103 | Query result: 3125323 104 | LP result: 893088.8766757513 105 | 16.0 106 | Time: 122.39418911933899 107 | Query result: 3125323 108 | LP result: 559596.9593205194 109 | 8.0 110 | Time: 137.82556049029031 111 | Query result: 3125323 112 | LP result: 330338.823681065 113 | 4.0 114 | Time: 95.66699075698853 115 | Query result: 3125323 116 | LP result: 185391.8884848852 117 | 2.0 118 | Time: 133.85588828722635 119 | Query result: 3125323 120 | LP result: 99566.36243664622 121 | -------------------------------------------------------------------------------- /Script/System.py: -------------------------------------------------------------------------------- 1 | import getopt 2 | import os 3 | import sys 4 | 5 | def main(argv): 6 | # Name of the database to be queried 7 | global database_name 8 | # Path of the txt file storing the query 9 | global query_path 10 | # Name of the private relation 11 | global private_relation_path 12 | # Path of the txt file storing the primary key(s) of the private relation 13 | global primary_key_path 14 | #Privacy budget 15 | global epsilon 16 | epsilon = 0.1 17 | #Error probablity: with probablity at least 1-beta, the error can be bounded 18 | global beta 19 | beta = 0.1 20 | #The global sensitivity 21 | global global_sensitivity 22 | global_sensitivity = 1000000 23 | #The number of processor 24 | global processor_num 25 | processor_num = 10 26 | try: 27 | opts, args = getopt.getopt(argv,"h:D:Q:P:K:e:b:G:p:",["Database=","QueryPath=","PrivateRelationPath=","PrimaryKey=","epsilon=","beta=","GlobalSensitivity=","ProcessorNum="]) 28 | except getopt.GetoptError: 29 | print("System.py -D -Q -P -K -e -b -G -p ") 30 | sys.exit(2) 31 | for opt, arg in opts: 32 | if opt == '-h': 33 | print("System.py -D -Q -P -K -e -b -G -p ") 34 | sys.exit() 35 | elif opt in ("-D", "--Database"): 36 | database_name = arg 37 | elif opt in ("-Q","--QueryPath"): 38 | query_path = arg 39 | elif opt in ("-P","--PrivateRelationName"): 40 | private_relation_path = arg 41 | elif opt in ("-K","--PrimaryKey"): 42 | primary_key_path=arg 43 | elif opt in ("-e","--epsilon"): 44 | epsilon = float(arg) 45 | elif opt in ("-b","--beta"): 46 | beta = float(arg) 47 | elif opt in ("-G","--GlobalSensitivity"): 48 | global_sensitivity = float(arg) 49 | elif opt in ("-p","--ProcessorNum"): 50 | processor_num = int(arg) 51 | #Extract Relationship between base tables' tuples 52 | cur_path=os.getcwd() 53 | cmd = "python "+cur_path+"/../Code/SystemExtractInfo.py -D "+database_name+" -Q "+query_path 54 | cmd = cmd+" -P "+private_relation_path+" -K "+primary_key_path+" -O "+cur_path+"/../Temp/TempInfo.txt" 55 | shell = os.popen(cmd, 'r') 56 | shell.read() 57 | shell.close() 58 | # Run R2T 59 | cmd = "python "+cur_path+"/../Code/R2T.py -I "+cur_path+"/../Temp/TempInfo.txt" 60 | cmd = cmd+" -b"+str(beta)+" -e "+str(epsilon)+" -G "+str(global_sensitivity)+" -p "+str(processor_num) 61 | shell = os.popen(cmd, 'r') 62 | res = shell.read() 63 | res = res.split() 64 | print("Noised Result") 65 | print(res[5]) 66 | shell.close() 67 | # Delete the temp file 68 | cmd = "rm "+cur_path+"/../Temp/TempInfo.txt" 69 | shell = os.popen(cmd, 'r') 70 | shell.read() 71 | shell.close() 72 | 73 | 74 | 75 | if __name__ == "__main__": 76 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /Script/CollectResultsLP.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import sys 3 | import os 4 | import random 5 | import math 6 | 7 | 8 | 9 | def LapNoise(): 10 | a = random.uniform(0,1) 11 | b = math.log(1/(1-a)) 12 | c = random.uniform(0,1) 13 | if c>0.5: 14 | return b 15 | else: 16 | return -b 17 | 18 | 19 | 20 | def Process(i,j, cur_path): 21 | global Q 22 | global max_degree 23 | global q_pow 24 | global Data 25 | repeat_time = 100 26 | input_file_path = cur_path+"/../Result/Graph/LP_All_Tau_"+str(Q[j])+"_"+Data[i]+".txt" 27 | input_file = open(input_file_path, 'r') 28 | LP_res = {} 29 | LP_time = {} 30 | LP_over_time = {} 31 | res = 0 32 | lines = input_file.readlines() 33 | GS = pow(max_degree[i],q_pow[j]) 34 | ii = 0 35 | tau = GS 36 | num_line = len(lines) 37 | tau_list = [] 38 | while(tau>=2): 39 | tau_list.append(tau) 40 | if ii*4+3>num_line: 41 | LP_time[tau] = float(60*60*6) 42 | LP_res[tau] = float(10000000000) 43 | LP_over_time[tau] = True 44 | tau/=2 45 | ii+=1 46 | continue 47 | l1 = lines[ii*4+1] 48 | l2 = lines[ii*4+2] 49 | l3 = lines[ii*4+3] 50 | elements = l1.split() 51 | LP_time[tau] = float(elements[1]) 52 | elements = l2.split() 53 | res = float(elements[2]) 54 | elements = l3.split() 55 | LP_res[tau] = float(elements[2]) 56 | LP_over_time[tau] = False 57 | tau/=2 58 | ii+=1 59 | output_file = cur_path+"/../Result/Graph/LP_"+str(Q[j])+"_"+Data[i]+".txt" 60 | output = open(output_file, 'w') 61 | for k in range(8): 62 | fail_time = 0 63 | err = [] 64 | e = 0.1*pow(2,k) 65 | total_time = 0 66 | for j in range(repeat_time): 67 | a = random.uniform(0,1) 68 | tau = tau_list[int(a*len(tau_list))] 69 | total_time += LP_time[tau]/repeat_time 70 | if LP_over_time[tau]==True: 71 | fail_time +=1 72 | err.append(abs(res-LP_res[tau]-LapNoise()*tau/e)/repeat_time) 73 | else: 74 | err.append(abs(res-LP_res[tau]-LapNoise()*tau/e)/repeat_time) 75 | err.sort() 76 | if fail_timeint(repeat_time*0.45): 79 | print("error") 80 | fail_time = int(repeat_time*0.48) 81 | #First divide repeat_time and then multiply is to avoid the result too large to overflow 82 | total_err = sum(err[fail_time:repeat_time-fail_time])/(repeat_time-2*fail_time)*repeat_time 83 | output.write(str(pow(2,k)*0.1)+" "+str(res)+" "+str(total_err)+" "+str(total_time)+"\n") 84 | 85 | 86 | 87 | def main(argv): 88 | global Q 89 | global max_degree 90 | global q_pow 91 | global Data 92 | cur_path=os.getcwd() 93 | Q = ["one_path","triangle","two_path", "rectangle"] 94 | Data = ["Amazon2","Amazon1","RoadnetPA","RoadnetCA","Deezer"] 95 | max_degree = [1024,1024,16,16,1024] 96 | q_pow = [1,2,2,3] 97 | for i in range(len(Data)): 98 | for j in range(len(Q)): 99 | Process(i,j, cur_path) 100 | 101 | 102 | 103 | if __name__ == "__main__": 104 | main(sys.argv[1:]) 105 | 106 | -------------------------------------------------------------------------------- /Code/R2TSJF.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import getopt 3 | import math 4 | import sys 5 | import random 6 | import time 7 | 8 | 9 | 10 | def ReadInput(): 11 | global input_file_path 12 | global size_dic 13 | global real_query_result 14 | real_query_result = 0 15 | size_dic = {} 16 | input_file = open(input_file_path,'r') 17 | for line in input_file.readlines(): 18 | elements = line.split() 19 | value = float(elements[0]) 20 | entity = int(elements[1]) 21 | real_query_result += value 22 | if entity in size_dic.keys(): 23 | size_dic[entity] += value 24 | else: 25 | size_dic[entity] = value 26 | 27 | 28 | 29 | def LapNoise(): 30 | a = random.uniform(0,1) 31 | b = math.log(1/(1-a)) 32 | c = random.uniform(0,1) 33 | if c>0.5: 34 | return b 35 | else: 36 | return -b 37 | 38 | 39 | 40 | def RunAlgorithm(): 41 | global global_sensitivity 42 | global beta 43 | base = 5.5 44 | max_i = int(math.log(global_sensitivity,base)) 45 | if max_i<=1: 46 | max_i+=1 47 | max_res1 = -10000000 48 | for i in range(1,max_i+1): 49 | tau = math.pow(base,i) 50 | t_res2 = LP(tau)+LapNoise()*math.pow(base,i)/epsilon*max_i 51 | t_res1 = t_res2 - math.pow(base,i)/epsilon*max_i*math.log(max_i/beta,2.9718) 52 | if t_res1>max_res1: 53 | max_res1 = t_res1 54 | return max_res1 55 | 56 | 57 | 58 | def LP(tau): 59 | global size_dic 60 | res = 0 61 | for element in size_dic.keys(): 62 | res += min(tau,size_dic[element]) 63 | return res 64 | 65 | 66 | 67 | def main(argv): 68 | #The input file including the relationships between aggregations and base tuples 69 | global input_file_path 70 | input_file_path = "" 71 | #Privacy budget 72 | global epsilon 73 | epsilon = 0.1 74 | #Error probablity: with probablity at least 1-beta, the error can be bounded 75 | global beta 76 | beta = 0.1 77 | #The global sensitivity 78 | global global_sensitivity 79 | global real_query_result 80 | global_sensitivity = 1000000 81 | try: 82 | opts, args = getopt.getopt(argv,"h:I:e:b:G:",["Input=","epsilon=","beta=","GlobalSensitivity="]) 83 | except getopt.GetoptError: 84 | print("R2TSJF.py -I -e -b -G ") 85 | sys.exit(2) 86 | for opt, arg in opts: 87 | if opt == '-h': 88 | print("R2TSJF.py -I -e -b -G 0.000001): 28 | if CauchyCum(mid) > a: 29 | right = mid 30 | else: 31 | left = mid 32 | mid = (left + right) / 2.0 33 | 34 | c = random.uniform(0, 1) 35 | 36 | if c > 0.5: 37 | return mid 38 | else: 39 | return -mid 40 | 41 | def main(argv): 42 | global repeat_times 43 | global trials 44 | global epsilons 45 | global graphs 46 | global ks 47 | 48 | try: 49 | opts, args = getopt.getopt(argv,"h:G:Q:e:",["Graph=","Query=","epsilon="]) 50 | except getopt.GetoptError: 51 | print("CollectResultsNT.py -G -Q -e ") 52 | sys.exit(2) 53 | for opt, arg in opts: 54 | if opt == "-h": 55 | print("CollectResultsNT.py -G -Q -e ") 56 | sys.exit() 57 | elif opt in ("-G", "--Graph"): 58 | if str(arg) in graphs: 59 | graphs = [str(arg)] 60 | elif opt in ("-Q", "--Query"): 61 | if str(arg) in ks: 62 | ks = [str(arg)] 63 | elif opt in ("-e", "--epsilon"): 64 | if float(arg) in epsilons: 65 | epsilons = [float(arg)] 66 | 67 | count_dict = {} 68 | ss_dict = {} 69 | time_dict = {} 70 | 71 | cur_path = os.getcwd() 72 | 73 | for graph in graphs: 74 | if graph == "Amazon2" or graph == "Amazon1" or graph == "Deezer": 75 | thetas = [1024.0, 512.0, 256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0] 76 | max_theta = 1024.0 77 | else: 78 | thetas = [16.0, 8.0, 4.0, 2.0] 79 | max_theta = 16.0 80 | 81 | for i in range(len(ks)): 82 | query = ks[i] 83 | 84 | output_file = open(cur_path + "/../Result/Graph/NT_" + query + "_" + graph + ".txt", 'w') 85 | 86 | for epsilon in epsilons: 87 | for theta in thetas: 88 | sum_time = 0 89 | 90 | cmd = "python " + cur_path + "/../Code/NT.py -I " + cur_path + "/../Information/Graph/one_path/" + graph + ".txt -e " + str(epsilon) + " -t " + str(int(theta)) + " -k " + str(i) + " -D NT_" + graph 91 | 92 | for j in range(repeat_times): 93 | shell = os.popen(cmd, 'r') 94 | res = shell.read() 95 | res = res.split() 96 | 97 | time = float(res[7]) 98 | 99 | if j == 0: 100 | count = int(float(res[2])) 101 | ss = float(res[5]) 102 | 103 | count_dict[(graph, query, theta)] = count 104 | ss_dict[(graph, query, epsilon, theta)] = ss 105 | 106 | sum_time += time 107 | 108 | average_time = sum_time / repeat_times 109 | 110 | time_dict[(graph, query, epsilon, theta)] = average_time 111 | 112 | errors = [] 113 | 114 | for j in range(trials): 115 | random_theta = random.choice(thetas) 116 | 117 | result = count_dict[(graph, query, random_theta)] + CauNoise() * 10 * ss_dict[(graph, query, epsilon, random_theta)] / epsilon 118 | real_count = count_dict[(graph, query, max_theta)] 119 | 120 | error = abs(result - real_count) 121 | errors.append(error) 122 | 123 | errors.sort() 124 | 125 | sum_time = 0 126 | 127 | for theta in thetas: 128 | sum_time += time_dict[(graph, query, epsilon, theta)] 129 | 130 | average_time = sum_time / len(thetas) 131 | 132 | output_file.write(str(epsilon) + " " + str(real_count) + " " + str(sum(errors[int(float(trials * 0.2)) : trials - int(float(trials * 0.2))]) / int(float(trials * 0.6))) + " " + str(average_time) + "\n") 133 | 134 | if __name__ == "__main__": 135 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /Script/CollectResultsGraph.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import sys 3 | import os 4 | import multiprocessing 5 | manager = multiprocessing.Manager() 6 | 7 | 8 | 9 | def main(argv): 10 | repeat_time = 10 11 | threads_num = 1 12 | global Data 13 | global Q 14 | global max_degree 15 | global q_pow 16 | global queries 17 | global times 18 | global results 19 | cur_path=os.getcwd() 20 | Data = manager.list() 21 | Q = manager.list() 22 | max_degree = manager.list() 23 | q_pow = manager.list() 24 | Q = ["one_path","triangle","two_path", "rectangle"] 25 | Data = ["Amazon2","Amazon1","RoadnetPA","RoadnetCA","Deezer"] 26 | max_degree = [1024,1024,16,16,1024] 27 | q_pow = [1,2,2,3] 28 | queries = manager.list() 29 | times = manager.list() 30 | results = manager.list() 31 | for i in range(len(Data)): 32 | time_i = manager.list() 33 | result_i = manager.list() 34 | query_i = manager.list() 35 | for j in range(len(Q)): 36 | time_i_j = manager.list() 37 | result_i_j = manager.list() 38 | for k in range(8): 39 | time_i_j_k = 0.0 40 | result_i_j_k = manager.list() 41 | time_i_j.append(time_i_j_k) 42 | result_i_j.append(result_i_j_k) 43 | time_i.append(time_i_j) 44 | result_i.append(result_i_j) 45 | query_i.append(0) 46 | times.append(time_i) 47 | results.append(result_i) 48 | queries.append(query_i) 49 | #Assign works to threads 50 | assigned_i = [] 51 | assigned_j = [] 52 | assigned_k = [] 53 | for i in range(threads_num): 54 | assigned_i.append([]) 55 | assigned_j.append([]) 56 | assigned_k.append([]) 57 | start_id = 0 58 | for i in range(len(Data)): 59 | for j in range(len(Q)): 60 | for k in range(8): 61 | for f in range(repeat_time): 62 | assigned_i[start_id].append(i) 63 | assigned_j[start_id].append(j) 64 | assigned_k[start_id].append(k) 65 | start_id = (start_id+1)%threads_num 66 | threads = [] 67 | for i in range(threads_num): 68 | threads.append(multiprocessing.Process(target=ThreadWork,args=(i,assigned_i[i],assigned_j[i],assigned_k[i],cur_path))) 69 | for i in range(threads_num): 70 | threads[i].start() 71 | for i in range(threads_num): 72 | threads[i].join() 73 | for i in range(len(Data)): 74 | for j in range(len(Q)): 75 | output_file = cur_path+"/../Result/Graph/R2T_"+str(Q[j])+"_"+Data[i]+".txt" 76 | output = open(output_file, 'w') 77 | for k in range(8): 78 | times[i][j][k] /= repeat_time 79 | results[i][j][k].sort() 80 | res = sum(results[i][j][k])-results[i][j][k][0]-results[i][j][k][1]-results[i][j][k][repeat_time-1]-results[i][j][k][repeat_time-2] 81 | res = res/(repeat_time-4) 82 | output.write(str(pow(2,k)*0.1)+" "+str(queries[i][j])+" "+str(res)+" "+str(times[i][j][k])+"\n") 83 | 84 | 85 | 86 | def ThreadWork(thread_id,assigned_i,assigned_j,assigned_k,cur_path): 87 | global Data 88 | global Q 89 | global max_degree 90 | global q_pow 91 | global queries 92 | global times 93 | global results 94 | work_num = len(assigned_i) 95 | for l in range(work_num): 96 | i = assigned_i[l] 97 | j = assigned_j[l] 98 | k = assigned_k[l] 99 | print(str(i)+" "+str(j)+" "+str(k)) 100 | #Create a new file 101 | cmd = "cp "+cur_path+"/../Information/Graph/"+Q[j]+"/"+Data[i]+".txt "+cur_path+"/../Temp/"+Q[j]+"_"+Data[i]+"_"+str(thread_id)+".txt" 102 | shell = os.popen(cmd, 'r') 103 | shell.read() 104 | shell.close() 105 | #Collect the result for algorithm 106 | cmd = "python "+cur_path+"/../Code/R2T.py -I "+cur_path+"/../Temp/"+Q[j]+"_"+Data[i]+"_"+str(thread_id)+".txt" 107 | cmd = cmd+" -b 0.1 -e "+str(pow(2,k)*0.1)+" -G "+str(pow(max_degree[i],q_pow[j]))+" -p 10" 108 | shell = os.popen(cmd, 'r') 109 | res = shell.read() 110 | res = res.split() 111 | a = float(res[2]) 112 | b = float(res[5]) 113 | c = float(res[7]) 114 | results[i][j][k].append(abs(a-b)) 115 | queries[i][j] = a 116 | times[i][j][k] = times[i][j][k]+c 117 | shell.close() 118 | #Remove the new file 119 | cmd = "rm "+cur_path+"/../Temp/"+Q[j]+"_"+Data[i]+"_"+str(thread_id)+".txt" 120 | shell = os.popen(cmd, 'r') 121 | shell.read() 122 | shell.close() 123 | 124 | 125 | 126 | if __name__ == "__main__": 127 | main(sys.argv[1:]) 128 | 129 | -------------------------------------------------------------------------------- /Script/CollectResultsTPCH.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import sys 3 | import os 4 | import multiprocessing 5 | manager = multiprocessing.Manager() 6 | 7 | 8 | 9 | def main(argv): 10 | repeat_time = 10 11 | threads_num = 5 12 | global S 13 | global Q 14 | global GS 15 | global SJ 16 | global queries 17 | global times 18 | global results 19 | cur_path=os.getcwd() 20 | S = manager.list() 21 | Q = manager.list() 22 | GS = manager.list() 23 | SJ = manager.list() 24 | Q = [5,8,21,3,12,20,10,7,11,18] 25 | S = ["3"] 26 | GS = [] 27 | for i in range(len(Q)): 28 | GS.append(1000000) 29 | SJ = [1,1,1,0,0,0,0,1,0,0] 30 | queries = manager.list() 31 | times = manager.list() 32 | results = manager.list() 33 | for i in range(len(S)): 34 | time_i = manager.list() 35 | result_i = manager.list() 36 | query_i = manager.list() 37 | for j in range(len(Q)): 38 | time_i_j = manager.list() 39 | result_i_j = manager.list() 40 | for k in range(8): 41 | time_i_j_k = 0.0 42 | result_i_j_k = manager.list() 43 | time_i_j.append(time_i_j_k) 44 | result_i_j.append(result_i_j_k) 45 | time_i.append(time_i_j) 46 | result_i.append(result_i_j) 47 | query_i.append(0) 48 | times.append(time_i) 49 | results.append(result_i) 50 | queries.append(query_i) 51 | #Assign works to threads 52 | assigned_i = [] 53 | assigned_j = [] 54 | assigned_k = [] 55 | for i in range(threads_num): 56 | assigned_i.append([]) 57 | assigned_j.append([]) 58 | assigned_k.append([]) 59 | start_id = 0 60 | for i in range(len(S)): 61 | for j in range(len(Q)): 62 | for k in range(8): 63 | for f in range(repeat_time): 64 | assigned_i[start_id].append(i) 65 | assigned_j[start_id].append(j) 66 | assigned_k[start_id].append(k) 67 | start_id = (start_id+1)%threads_num 68 | threads = [] 69 | for i in range(threads_num): 70 | threads.append(multiprocessing.Process(target=ThreadWork,args=(i,assigned_i[i],assigned_j[i],assigned_k[i],cur_path))) 71 | for i in range(threads_num): 72 | threads[i].start() 73 | for i in range(threads_num): 74 | threads[i].join() 75 | for i in range(len(S)): 76 | for j in range(len(Q)): 77 | output_file = cur_path+"/../Result/TPCH/R2T_Q"+str(Q[j])+".txt" 78 | output = open(output_file, 'w') 79 | for k in range(8): 80 | times[i][j][k] /= repeat_time 81 | results[i][j][k].sort() 82 | res = sum(results[i][j][k])-results[i][j][k][0]-results[i][j][k][1]-results[i][j][k][repeat_time-1]-results[i][j][k][repeat_time-2] 83 | res = res/(repeat_time-4) 84 | output.write(str(pow(2,k)*0.1)+" "+str(queries[i][j])+" "+str(res)+" "+str(times[i][j][k])+"\n") 85 | 86 | 87 | 88 | def ThreadWork(thread_id,assigned_i,assigned_j,assigned_k,cur_path): 89 | global S 90 | global Q 91 | global GS 92 | global SJ 93 | global queries 94 | global times 95 | global results 96 | work_num = len(assigned_i) 97 | for l in range(work_num): 98 | i = assigned_i[l] 99 | j = assigned_j[l] 100 | k = assigned_k[l] 101 | print(str(i)+" "+str(j)+" "+str(k)) 102 | #Create a new file 103 | cmd = "cp "+cur_path+"/../Information/TPCH/Q"+str(Q[j])+"_"+S[i]+".txt "+cur_path+"/../Temp/Q"+str(Q[j])+"_"+str(thread_id)+".txt" 104 | shell = os.popen(cmd, 'r') 105 | shell.read() 106 | shell.close() 107 | #Collect the result for algorithm 108 | cmd = "python "+cur_path+"/../Code/R2T" 109 | if SJ[j]==0: 110 | cmd = cmd+"SJF" 111 | cmd = cmd+".py -I "+cur_path+"/../Temp/Q"+str(Q[j])+"_"+str(thread_id)+".txt" 112 | cmd = cmd+" -b 0.1 -e "+str(pow(2,k)*0.1)+" -G "+str(GS[j]) 113 | if SJ[j]==1: 114 | cmd = cmd+" -p 10" 115 | shell = os.popen(cmd, 'r') 116 | res = shell.read() 117 | res = res.split() 118 | a = float(res[2]) 119 | b = float(res[5]) 120 | c = float(res[7]) 121 | results[i][j][k].append(abs(a-b)) 122 | queries[i][j] = a 123 | times[i][j][k] = times[i][j][k]+c 124 | shell.close() 125 | #Remove the new file 126 | cmd = "rm "+cur_path+"/../Temp/Q"+str(Q[j])+"_"+str(thread_id)+".txt" 127 | shell = os.popen(cmd, 'r') 128 | shell.read() 129 | shell.close() 130 | 131 | 132 | 133 | if __name__ == "__main__": 134 | main(sys.argv[1:]) 135 | -------------------------------------------------------------------------------- /Script/CollectResultsTPCHScalability.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import sys 3 | import os 4 | import multiprocessing 5 | manager = multiprocessing.Manager() 6 | 7 | 8 | 9 | def main(argv): 10 | repeat_time = 10 11 | threads_num = 1 12 | global S 13 | global Q 14 | global GS 15 | global SJ 16 | global queries 17 | global times 18 | global results 19 | cur_path=os.getcwd() 20 | S = manager.list() 21 | Q = manager.list() 22 | GS = manager.list() 23 | SJ = manager.list() 24 | S = ["0","1","2","3","4","5","6"] 25 | Q = [3,12,20] 26 | GS = [] 27 | for i in range(len(Q)): 28 | GS.append(1000000) 29 | SJ = [0,0,0] 30 | queries = manager.list() 31 | times = manager.list() 32 | results = manager.list() 33 | for i in range(len(S)): 34 | time_i = manager.list() 35 | result_i = manager.list() 36 | query_i = manager.list() 37 | for j in range(len(Q)): 38 | time_i_j = manager.list() 39 | result_i_j = manager.list() 40 | for k in range(1): 41 | time_i_j_k = 0 42 | result_i_j_k = manager.list() 43 | time_i_j.append(time_i_j_k) 44 | result_i_j.append(result_i_j_k) 45 | time_i.append(time_i_j) 46 | result_i.append(result_i_j) 47 | query_i.append(0) 48 | times.append(time_i) 49 | results.append(result_i) 50 | queries.append(query_i) 51 | #Assign works to threads 52 | assigned_i = [] 53 | assigned_j = [] 54 | assigned_k = [] 55 | for i in range(threads_num): 56 | assigned_i.append([]) 57 | assigned_j.append([]) 58 | assigned_k.append([]) 59 | start_id = 0 60 | for i in range(len(S)): 61 | for j in range(len(Q)): 62 | for k in range(1): 63 | for f in range(repeat_time): 64 | assigned_i[start_id].append(i) 65 | assigned_j[start_id].append(j) 66 | assigned_k[start_id].append(k) 67 | start_id = (start_id+1)%threads_num 68 | threads = [] 69 | for i in range(threads_num): 70 | threads.append(multiprocessing.Process(target=ThreadWork,args=(i,assigned_i[i],assigned_j[i],assigned_k[i],cur_path))) 71 | for i in range(threads_num): 72 | threads[i].start() 73 | for i in range(threads_num): 74 | threads[i].join() 75 | for j in range(len(Q)): 76 | output_file = cur_path+"/../Result/TPCH/R2T_Q"+str(Q[j])+"_Scalability.txt" 77 | output = open(output_file, 'w') 78 | for i in range(len(S)): 79 | for k in range(1): 80 | times[i][j][k] /= repeat_time 81 | results[i][j][k].sort() 82 | res = sum(results[i][j][k])-results[i][j][k][0]-results[i][j][k][1]-results[i][j][k][repeat_time-1]-results[i][j][k][repeat_time-2] 83 | res = res/(repeat_time-4) 84 | output.write(str(1/8*pow(2,i))+" "+str(queries[i][j])+" "+str(res)+" "+str(times[i][j][k])+"\n") 85 | 86 | 87 | 88 | def ThreadWork(thread_id,assigned_i,assigned_j,assigned_k,cur_path): 89 | global S 90 | global Q 91 | global GS 92 | global SJ 93 | global queries 94 | global times 95 | global results 96 | work_num = len(assigned_i) 97 | for l in range(work_num): 98 | i = assigned_i[l] 99 | j = assigned_j[l] 100 | k = assigned_k[l] 101 | print(str(i)+" "+str(j)+" "+str(k)) 102 | #Create a new file 103 | cmd = "cp "+cur_path+"/../Information/TPCH/Q"+str(Q[j])+"_"+S[i]+".txt "+cur_path+"/../Temp/ScalabilityQ"+str(Q[j])+"_"+S[i]+"_"+str(thread_id)+".txt" 104 | shell = os.popen(cmd, 'r') 105 | shell.read() 106 | shell.close() 107 | #Collect the result for algorithm 108 | cmd = "python "+cur_path+"/../Code/R2T" 109 | if SJ[j]==0: 110 | cmd = cmd+"SJF" 111 | cmd = cmd+".py -I "+cur_path+"/../Temp/ScalabilityQ"+str(Q[j])+"_"+S[i]+"_"+str(thread_id)+".txt" 112 | cmd = cmd+" -b 0.1 -e "+str(pow(2,k)*0.8)+" -G "+str(GS[j]) 113 | if SJ[j]==1: 114 | cmd = cmd+" -p 10" 115 | shell = os.popen(cmd, 'r') 116 | res = shell.read() 117 | res = res.split() 118 | a = float(res[2]) 119 | b = float(res[5]) 120 | c = float(res[7]) 121 | results[i][j][k].append(abs(a-b)) 122 | queries[i][j] = a 123 | times[i][j][k] = times[i][j][k]+c 124 | shell.close() 125 | #Remove the new file 126 | cmd = "rm "+cur_path+"/../Temp/ScalabilityQ"+str(Q[j])+"_"+S[i]+"_"+str(thread_id)+".txt" 127 | shell = os.popen(cmd, 'r') 128 | shell.read() 129 | shell.close() 130 | 131 | 132 | 133 | if __name__ == "__main__": 134 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /Script/CollectResultsLPAllTau.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import sys 3 | import getopt 4 | import cplex 5 | import numpy as np 6 | import time 7 | import os 8 | 9 | 10 | 11 | def main(argv): 12 | global Data 13 | global Q 14 | global max_degree 15 | global q_pow 16 | global queries 17 | global times 18 | global results 19 | global results_enhanced 20 | global cur_path 21 | global time_repeat 22 | global error_repeat 23 | time_repeat = 10 24 | cur_path=os.getcwd() 25 | Q = ["one_path","triangle","two_path", "rectangle"] 26 | Data = ["Amazon2","Amazon1","RoadnetPA","RoadnetCA","Deezer"] 27 | max_degree = [1024,1024,16,16,1024] 28 | q_pow = [1,2,2,3] 29 | i=0 30 | j=0 31 | try: 32 | opts, args = getopt.getopt(argv,"h:Q:D:",["QueryId=","DataId="]) 33 | except getopt.GetoptError: 34 | print("CollectResultsLPAllTau.py -Q -D ") 35 | sys.exit(2) 36 | for opt, arg in opts: 37 | if opt == '-h': 38 | print("CollectResultsLPAllTau.py -Q -D ") 39 | sys.exit() 40 | elif opt in ("-Q", "--QueryId"): 41 | j = int(arg) 42 | elif opt in ("-D", "--DataId"): 43 | i = int(arg) 44 | Process(i,j,cur_path) 45 | 46 | 47 | 48 | def ReadInput(input_file_path): 49 | global tuples 50 | global connections 51 | global downward_sensitivity 52 | global real_query_result 53 | size_dic = {} 54 | id_dic = {} 55 | id_num = 0 56 | real_query_result = 0 57 | #Collect the DS 58 | downward_sensitivity = 0 59 | #The variable is repsented one entity 60 | #We use connection to show the connections between entity and query results 61 | tuples = [] 62 | connections = [] 63 | input_file = open(input_file_path,'r') 64 | for line in input_file.readlines(): 65 | real_query_result += 1 66 | elements = line.split() 67 | connection = [] 68 | for element in elements[1:]: 69 | element = int(element) 70 | #Re-order the IDs 71 | if element in id_dic.keys(): 72 | element = id_dic[element] 73 | else: 74 | tuples.append(id_num) 75 | id_dic[element] = id_num 76 | element = id_num 77 | id_num+=1 78 | if element in size_dic.keys(): 79 | size_dic[element]+=1 80 | else: 81 | size_dic[element] = 1 82 | if downward_sensitivity<=size_dic[element]: 83 | downward_sensitivity = size_dic[element]; 84 | connection.append(element) 85 | connections.append(connection) 86 | 87 | 88 | 89 | def LPSolver(tau): 90 | global tuples 91 | global connections 92 | global real_query_result 93 | num_constraints = len(tuples) 94 | num_variables = len(connections) 95 | # Set the obj 96 | cpx = cplex.Cplex() 97 | cpx.set_log_stream(None) 98 | cpx.set_error_stream(None) 99 | cpx.set_warning_stream(None) 100 | cpx.set_results_stream(None) 101 | cpx.objective.set_sense(cpx.objective.sense.maximize) 102 | #Set variables 103 | obj = np.ones(num_variables) 104 | ub = np.ones(num_variables) 105 | cpx.variables.add(obj=obj, ub=ub) 106 | #Set the right hand side and the sign 107 | rhs = np.ones(num_constraints)*tau 108 | senses = "L" * num_constraints 109 | cpx.linear_constraints.add(rhs=rhs, senses=senses) 110 | #Set the coefficients 111 | cols = [] 112 | rows = [] 113 | vals = [] 114 | for i in range(num_variables): 115 | for j in connections[i]: 116 | cols.append(i) 117 | rows.append(j) 118 | vals.append(1) 119 | cpx.linear_constraints.set_coefficients(zip(rows, cols, vals)) 120 | cpx.solve() 121 | return cpx.solution.get_objective_value() 122 | 123 | 124 | 125 | def Process(i,j,cur_path): 126 | global time_repeat 127 | global error_repeat 128 | global real_query_result 129 | ReadInput(cur_path+"/../Information/Graph/"+Q[j]+"/"+Data[i]+".txt") 130 | GS = pow(max_degree[i],q_pow[j]) 131 | tau = GS 132 | while(tau>=2): 133 | print(str(tau)) 134 | used_time = 0 135 | res = 0 136 | for ii in range(time_repeat): 137 | start = time.time() 138 | res = LPSolver(tau) 139 | end= time.time() 140 | used_time+=end-start 141 | used_time/=time_repeat 142 | print("Time: "+str(used_time)) 143 | print("Query result: "+str(real_query_result)) 144 | print("LP result: "+str(res)) 145 | tau/=2 146 | 147 | 148 | if __name__ == "__main__": 149 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /Script/CollectResultsR2TOld.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import sys 3 | import os 4 | import multiprocessing 5 | manager = multiprocessing.Manager() 6 | 7 | 8 | 9 | def main(argv): 10 | repeat_time = 10 11 | threads_num = 5 12 | global Data 13 | global Q 14 | global max_degree 15 | global q_pow 16 | global queries 17 | global times 18 | global results 19 | cur_path=os.getcwd() 20 | Data = manager.list() 21 | Q = manager.list() 22 | max_degree = manager.list() 23 | q_pow = manager.list() 24 | Q = ["one_path","triangle","two_path", "rectangle"] 25 | Data = ["Amazon2","Amazon1","RoadnetPA","RoadnetCA","Deezer"] 26 | max_degree = [1024,512,16,16,512] 27 | q_pow = [1,2,2,3] 28 | queries = manager.list() 29 | times = manager.list() 30 | results = manager.list() 31 | for i in range(len(Data)): 32 | time_i = manager.list() 33 | result_i = manager.list() 34 | query_i = manager.list() 35 | for j in range(len(Q)): 36 | time_i_j = manager.list() 37 | result_i_j = manager.list() 38 | for k in range(8): 39 | time_i_j_k = 0.0 40 | result_i_j_k = manager.list() 41 | time_i_j.append(time_i_j_k) 42 | result_i_j.append(result_i_j_k) 43 | time_i.append(time_i_j) 44 | result_i.append(result_i_j) 45 | query_i.append(0) 46 | times.append(time_i) 47 | results.append(result_i) 48 | queries.append(query_i) 49 | #Assign works to threads 50 | assigned_i = [] 51 | assigned_j = [] 52 | assigned_k = [] 53 | for i in range(threads_num): 54 | assigned_i.append([]) 55 | assigned_j.append([]) 56 | assigned_k.append([]) 57 | start_id = 0 58 | for i in range(len(Data)): 59 | if i==4: 60 | continue 61 | for j in range(len(Q)): 62 | if j!=3: 63 | continue 64 | for k in range(8): 65 | if k!=3: 66 | continue 67 | for f in range(repeat_time): 68 | assigned_i[start_id].append(i) 69 | assigned_j[start_id].append(j) 70 | assigned_k[start_id].append(k) 71 | start_id = (start_id+1)%threads_num 72 | threads = [] 73 | for i in range(threads_num): 74 | threads.append(multiprocessing.Process(target=ThreadWork,args=(i,assigned_i[i],assigned_j[i],assigned_k[i],cur_path))) 75 | for i in range(threads_num): 76 | threads[i].start() 77 | for i in range(threads_num): 78 | threads[i].join() 79 | for i in range(len(Data)): 80 | if i==4: 81 | continue 82 | for j in range(len(Q)): 83 | if j!=3: 84 | continue 85 | output_file = cur_path+"/../Result/Graph/R2TOld_"+str(Q[j])+"_"+Data[i]+".txt" 86 | output = open(output_file, 'w') 87 | for k in range(8): 88 | if k!=3: 89 | continue 90 | print(str(i)+" "+str(j)+" "+str(k)) 91 | times[i][j][k] /= repeat_time 92 | results[i][j][k].sort() 93 | res = sum(results[i][j][k])-results[i][j][k][0]-results[i][j][k][1]-results[i][j][k][repeat_time-1]-results[i][j][k][repeat_time-2] 94 | res = res/(repeat_time-4) 95 | output.write(str(pow(2,k)*0.1)+" "+str(times[i][j][k])+"\n") 96 | 97 | 98 | 99 | def ThreadWork(thread_id,assigned_i,assigned_j,assigned_k,cur_path): 100 | global Data 101 | global Q 102 | global max_degree 103 | global q_pow 104 | global queries 105 | global times 106 | global results 107 | work_num = len(assigned_i) 108 | for l in range(work_num): 109 | i = assigned_i[l] 110 | j = assigned_j[l] 111 | k = assigned_k[l] 112 | print(str(i)+" "+str(j)+" "+str(k)) 113 | #Create a new file 114 | cmd = "cp "+cur_path+"/../Information/Graph/"+Q[j]+"/"+Data[i]+".txt "+cur_path+"/../Temp/Old"+Q[j]+"_"+Data[i]+"_"+str(thread_id)+".txt" 115 | shell = os.popen(cmd, 'r') 116 | shell.read() 117 | shell.close() 118 | #Collect the result for algorithm 119 | cmd = "python "+cur_path+"/../Code/R2TOld.py -I "+cur_path+"/../Temp/Old"+Q[j]+"_"+Data[i]+"_"+str(thread_id)+".txt" 120 | cmd = cmd+" -b 0.1 -e "+str(pow(2,k)*0.1)+" -G "+str(pow(max_degree[i],q_pow[j]))+" -p 10" 121 | shell = os.popen(cmd, 'r') 122 | res = shell.read() 123 | res = res.split() 124 | a = float(res[2]) 125 | b = float(res[5]) 126 | c = float(res[7]) 127 | results[i][j][k].append(abs(a-b)) 128 | queries[i][j] = a 129 | times[i][j][k] = times[i][j][k]+c 130 | shell.close() 131 | #Remove the new file 132 | cmd = "rm "+cur_path+"/../Temp/Old"+Q[j]+"_"+Data[i]+"_"+str(thread_id)+".txt" 133 | shell = os.popen(cmd, 'r') 134 | shell.read() 135 | shell.close() 136 | 137 | 138 | 139 | if __name__ == "__main__": 140 | main(sys.argv[1:]) 141 | 142 | -------------------------------------------------------------------------------- /Code/NT.py: -------------------------------------------------------------------------------- 1 | import cplex 2 | import getopt 3 | import math 4 | import numpy as np 5 | import os 6 | import psycopg2 7 | import random 8 | import sys 9 | import time 10 | 11 | def ReadInput(): 12 | global input_file_path 13 | global connections 14 | global size_dic 15 | global max_degree 16 | 17 | size_dic = {} 18 | id_dic = {} 19 | id_num = 0 20 | 21 | connections = [] 22 | 23 | input_file = open(input_file_path,'r') 24 | 25 | for line in input_file.readlines(): 26 | elements = line.split() 27 | connection = [] 28 | 29 | for element in elements[1 : ]: 30 | element = int(element) 31 | 32 | if element in id_dic.keys(): 33 | element = id_dic[element] 34 | else: 35 | id_dic[element] = id_num 36 | element = id_num 37 | id_num += 1 38 | 39 | if element in size_dic.keys(): 40 | size_dic[element] += 1 41 | else: 42 | size_dic[element] = 1 43 | 44 | connection.append(element) 45 | 46 | connections.append(connection) 47 | 48 | max_degree = max(size_dic.values()) 49 | 50 | def RestrictedSensitivity(): 51 | global theta 52 | global k 53 | 54 | if k == 0: # edge 55 | return theta 56 | elif k == 1: # triangle 57 | return theta * (theta - 1) / 2 58 | elif k == 2: # two path 59 | return theta * (theta - 1) * 3 / 2 60 | elif k == 3: # rectangle 61 | return theta * (theta - 1) * (theta - 1) / 2 62 | else: 63 | return 0 64 | 65 | def LocalSensitivity(i): 66 | global theta 67 | global size_dic 68 | 69 | count = 0 70 | 71 | for val in size_dic.values(): 72 | if val >= theta - i and val <= theta + i + 1: 73 | count += 1 74 | 75 | return count 76 | 77 | def CauchyCum(x): 78 | a = 1/4/math.sqrt(2)*(math.log(abs(x**2+math.sqrt(2)*x+1))+2*math.atan(math.sqrt(2)*x+1)) 79 | a += 1/4/math.sqrt(2)*(-math.log(abs(x**2-math.sqrt(2)*x+1))+2*math.atan(math.sqrt(2)*x-1)) 80 | 81 | return a 82 | 83 | def CauNoise(): 84 | a = random.uniform(0,math.pi/2/math.sqrt(2)) 85 | 86 | left = 0 87 | right = 6000 88 | mid = (left + right) / 2.0 89 | 90 | while(abs(CauchyCum(mid) - a) > 0.000001): 91 | if CauchyCum(mid) > a: 92 | right = mid 93 | else: 94 | left = mid 95 | mid = (left + right) / 2.0 96 | 97 | c = random.uniform(0, 1) 98 | 99 | if c > 0.5: 100 | return mid 101 | else: 102 | return -mid 103 | 104 | def Truncation(): 105 | global theta 106 | global connections 107 | global size_dic 108 | global connections_truncated 109 | global output_file_path 110 | global k 111 | 112 | connections_truncated = [] 113 | 114 | for connection in connections: 115 | if size_dic[connection[0]] <= theta and size_dic[connection[1]] <= theta: 116 | connections_truncated.append(connection) 117 | 118 | output_file_path = input_file_path[ : input_file_path.rfind('/')] + "/../../../Temp/nt_" + input_file_path[input_file_path.rfind('/') + 1 : ] + "_" + str(theta) + ".txt" 119 | output_file = open(output_file_path,'w') 120 | 121 | for connection in connections_truncated: 122 | output_file.write(str(connection[0]) + ' ' + str(connection[1]) + '\n') 123 | output_file.write(str(connection[1]) + ' ' + str(connection[0]) + '\n') 124 | 125 | def Count(): 126 | global k 127 | global connections_truncated 128 | global output_file_path 129 | global database_name 130 | global real_ans 131 | 132 | con = psycopg2.connect(dbname=database_name) 133 | cur = con.cursor() 134 | 135 | output_file = open(output_file_path, 'r') 136 | 137 | cur.execute("CREATE TABLE EDGE (FROM_ID INTEGER NOT NULL, TO_ID INTEGER NOT NULL);") 138 | cur.execute("CREATE INDEX on EDGE using hash (FROM_ID);") 139 | cur.execute("CREATE INDEX on EDGE using hash (TO_ID);") 140 | 141 | cur.copy_from(output_file, 'EDGE', sep=' ') 142 | 143 | num = 0 144 | query = "" 145 | 146 | if k == 0: # edge 147 | query = "SELECT count(*) FROM edge WHERE edge.from_id < edge.to_id;" 148 | elif k == 1: # triangle 149 | query = "SELECT count(*) FROM edge as r4, edge as r5, edge as r6 WHERE r4.from_id = r6.to_id and r5.from_id = r4.to_id and r6.from_id = r5.to_id and r4.from_id < r5.from_id and r5.from_id < r6.from_id;" 150 | elif k == 2: # two path 151 | query = "SELECT count(*) FROM edge as r4, edge as r5 WHERE r5.from_id = r4.to_id and r4.from_id < r5.to_id;" 152 | elif k == 3: # rectangle 153 | query = "SELECT count(*) FROM edge as r5, edge as r6, edge as r7, edge as r8 WHERE r5.from_id = r8.to_id and r6.from_id = r5.to_id and r7.from_id = r6.to_id and r8.from_id = r7.to_id and r5.from_id < r6.from_id and r5.from_id < r7.from_id and r5.from_id < r8.from_id and r6.from_id < r8.from_id;" 154 | else: 155 | con.commit() 156 | con.close() 157 | 158 | real_ans = num 159 | 160 | return real_ans 161 | 162 | cur.execute(query) 163 | 164 | num = int(cur.fetchall()[0][0]) 165 | 166 | cur.execute("DROP TABLE EDGE;") 167 | 168 | con.commit() 169 | con.close() 170 | 171 | os.remove(output_file_path) 172 | 173 | real_ans = num 174 | 175 | return real_ans 176 | 177 | def RunAlgorithm(): 178 | global epsilon 179 | global theta 180 | global max_degree 181 | global ss 182 | 183 | Truncation() 184 | 185 | base = math.e 186 | beta = epsilon / 10 187 | 188 | max_ss_truncation = 0 189 | 190 | for i in range(max(max_degree, theta)): 191 | ls_truncation = LocalSensitivity(i) + i + 1 192 | ss_truncation = math.pow(base, - beta * i) * ls_truncation 193 | if ss_truncation > max_ss_truncation: 194 | max_ss_truncation = ss_truncation 195 | 196 | ss = max_ss_truncation * RestrictedSensitivity() 197 | 198 | return Count() + CauNoise() * 10 * ss / epsilon 199 | 200 | def main(argv): 201 | global input_file_path 202 | global epsilon 203 | global theta 204 | global k 205 | global database_name 206 | global real_ans 207 | global ss 208 | 209 | try: 210 | opts, args = getopt.getopt(argv,"h:I:e:t:k:D:",["Input=","epsilon=","theta=","k=","D="]) 211 | except getopt.GetoptError: 212 | print("NT.py -I -e -t -k -D ") 213 | sys.exit(2) 214 | for opt, arg in opts: 215 | if opt == "-h": 216 | print("NT.py -I -e -t -k -D ") 217 | sys.exit() 218 | elif opt in ("-I", "--Input"): 219 | input_file_path = str(arg) 220 | elif opt in ("-e","--epsilon"): 221 | epsilon = float(arg) 222 | elif opt in ("-t","--theta"): 223 | theta = int(arg) 224 | elif opt in ("-k","--k"): 225 | k = int(arg) 226 | elif opt in ("-D","--Database"): 227 | database_name = str(arg) 228 | 229 | start = time.time() 230 | 231 | ReadInput() 232 | 233 | res = RunAlgorithm() 234 | 235 | end= time.time() 236 | 237 | print("Query Result") 238 | print(real_ans) 239 | print("Smooth Sensitivity") 240 | print(ss) 241 | print("Time") 242 | print(end - start) 243 | 244 | if __name__ == "__main__": 245 | main(sys.argv[1:]) 246 | -------------------------------------------------------------------------------- /Code/R2TOld.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import getopt 3 | import math 4 | import sys 5 | import random 6 | import cplex 7 | import numpy as np 8 | import time 9 | import multiprocessing 10 | manager = multiprocessing.Manager() 11 | 12 | 13 | def ReadInput(): 14 | global input_file_path 15 | global tuples 16 | global connections 17 | global downward_sensitivity 18 | size_dic = {} 19 | id_dic = {} 20 | id_num = 0 21 | #Collect the DS 22 | downward_sensitivity = 0 23 | #The variable is repsented one entity 24 | #We use connection to show the connections between entity and query results 25 | tuples = [] 26 | connections = [] 27 | input_file = open(input_file_path,'r') 28 | for line in input_file.readlines(): 29 | elements = line.split() 30 | connection = [] 31 | for element in elements[1:]: 32 | element = int(element) 33 | #Re-order the IDs 34 | if element in id_dic.keys(): 35 | element = id_dic[element] 36 | else: 37 | tuples.append(id_num) 38 | id_dic[element] = id_num 39 | element = id_num 40 | id_num+=1 41 | if element in size_dic.keys(): 42 | size_dic[element]+=1 43 | else: 44 | size_dic[element] = 1 45 | if downward_sensitivity<=size_dic[element]: 46 | downward_sensitivity = size_dic[element]; 47 | connection.append(element) 48 | connections.append(connection) 49 | 50 | 51 | 52 | def LapNoise(): 53 | a = random.uniform(0,1) 54 | b = math.log(1/(1-a)) 55 | c = random.uniform(0,1) 56 | if c>0.5: 57 | return b 58 | else: 59 | return -b 60 | 61 | 62 | 63 | def ThresholdRunAlgorithm(epsilon,beta,base, max_i, downward_sensitivity, real_query_result, assigned_taus): 64 | global tilde_Q_tau 65 | global Q_tau 66 | global hat_Q_tau 67 | for i in assigned_taus: 68 | tau = math.pow(base,i) 69 | if tau>=downward_sensitivity: 70 | t_res = real_query_result 71 | else: 72 | t_res = LPSolver(tau) 73 | Q_tau[i] = t_res 74 | hat_Q_tau[i] = t_res+LapNoise()*tau/epsilon*max_i 75 | tilde_Q_tau[i] = hat_Q_tau[i]-tau/epsilon*max_i*math.log(max_i/beta,2.9718) 76 | 77 | 78 | 79 | def RunAlgorithm(): 80 | global global_sensitivity 81 | global connections 82 | global downward_sensitivity 83 | global tilde_Q_tau 84 | global Q_tau 85 | global hat_Q_tau 86 | global epsilon 87 | global beta 88 | global real_query_result 89 | 90 | base = 5.5 91 | max_i = int(math.log(global_sensitivity,base)) 92 | if max_i<=1: 93 | max_i+=1 94 | real_query_result = len(connections) 95 | 96 | #Used to store the results 97 | Q_tau = manager.dict() 98 | tilde_Q_tau = manager.dict() 99 | hat_Q_tau = manager.dict() 100 | 101 | #Assign the tau's 102 | arrangement_of_taus = [] 103 | for i in range(processor_num): 104 | arrangement_of_taus.append([]) 105 | 106 | j = 0 107 | for i in range(1,max_i+1): 108 | arrangement_of_taus[j].append(i) 109 | j = (j+1)%processor_num 110 | Q_tau[i] = 0 111 | tilde_Q_tau[i] = 0 112 | hat_Q_tau[i] = 0 113 | 114 | threads = [] 115 | for i in range(processor_num): 116 | threads.append(multiprocessing.Process(target=ThresholdRunAlgorithm, args=(epsilon,beta,base, max_i, downward_sensitivity, real_query_result, arrangement_of_taus[i]))) 117 | threads[i].start() 118 | for i in range(processor_num): 119 | threads[i].join() 120 | 121 | max_ind = 1 122 | max_val = 0 123 | for i in range(1,max_i+1): 124 | if tilde_Q_tau[i]>max_val: 125 | max_val = tilde_Q_tau[i] 126 | max_ind = i 127 | final_res = tilde_Q_tau[max_ind] 128 | return final_res 129 | 130 | 131 | 132 | def LPSolver(tau): 133 | global tuples 134 | global connections 135 | num_constraints = len(tuples) 136 | num_variables = len(connections) 137 | 138 | # Set the obj 139 | cpx = cplex.Cplex() 140 | cpx.objective.set_sense(cpx.objective.sense.maximize) 141 | 142 | #Set variables 143 | obj = np.ones(num_variables) 144 | ub = np.ones(num_variables) 145 | cpx.variables.add(obj=obj, ub=ub) 146 | 147 | #Set the right hand side and the sign 148 | rhs = np.ones(num_constraints)*tau 149 | senses = "L" * num_constraints 150 | cpx.linear_constraints.add(rhs=rhs, senses=senses) 151 | 152 | #Set the coefficients 153 | cols = [] 154 | rows = [] 155 | vals = [] 156 | 157 | for i in range(num_variables): 158 | for j in connections[i]: 159 | cols.append(i) 160 | rows.append(j) 161 | vals.append(1) 162 | cpx.linear_constraints.set_coefficients(zip(rows, cols, vals)) 163 | cpx.set_log_stream(None) 164 | cpx.set_error_stream(None) 165 | cpx.set_warning_stream(None) 166 | cpx.set_results_stream(None) 167 | cpx.solve() 168 | return cpx.solution.get_objective_value() 169 | 170 | 171 | def main(argv): 172 | global input_file_path 173 | global epsilon 174 | global beta 175 | global global_sensitivity 176 | global processor_num 177 | global real_query_result 178 | processor_num = 1 179 | 180 | try: 181 | opts, args = getopt.getopt(argv,"h:I:e:b:G:p:",["Input=","epsilon=","beta=","GlobalSensitivity=","ProcessorNum="]) 182 | except getopt.GetoptError: 183 | print("R2TOld.py -I -e -b -G -p ") 184 | sys.exit(2) 185 | for opt, arg in opts: 186 | if opt == '-h': 187 | print("R2TOld.py -I -e -b -G -p ") 188 | sys.exit() 189 | elif opt in ("-I", "--Input"): 190 | input_file_path = str(arg) 191 | elif opt in ("-e","--epsilon"): 192 | epsilon = float(arg) 193 | elif opt in ("-b","--beta"): 194 | beta = float(arg) 195 | elif opt in ("-G","--GlobalSensitivity"): 196 | global_sensitivity = float(arg) 197 | elif opt in ("-p","--ProcessorNum"): 198 | processor_num = int(arg) 199 | if processor_num <1: 200 | processor_num = 1 201 | start = time.time() 202 | ReadInput() 203 | res = RunAlgorithm() 204 | end= time.time() 205 | print("Query Result") 206 | print(real_query_result) 207 | print("Noised Result") 208 | print(res) 209 | print("Time") 210 | print(end-start) 211 | 212 | 213 | 214 | if __name__ == "__main__": 215 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /Script/DrawFigureEps.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import matplotlib.pyplot as plt 3 | import sys 4 | import os 5 | 6 | 7 | 8 | def ReadData(path): 9 | res = 0 10 | err = [] 11 | input_file = open(path, 'r') 12 | for line in input_file.readlines(): 13 | elements = line.split() 14 | res = float(elements[1]) 15 | err.append(float(elements[2])) 16 | return res,err 17 | 18 | 19 | 20 | def main(argv): 21 | Q = ["one_path","two_path","triangle", "rectangle"] 22 | M = ["R2T","LP","RM", "NT", "SDE"] 23 | err = [] 24 | res = [] 25 | cur_path=os.getcwd() 26 | for i in range(len(Q)): 27 | err_i = [] 28 | res_i = 0 29 | for j in range(len(M)): 30 | if j==2: 31 | if i<2: 32 | err_i.append([]) 33 | continue 34 | path = cur_path+"/../Result/Graph/"+M[j]+"_"+Q[i]+"_RoadnetPA.txt" 35 | res_i,err_ij = ReadData(path) 36 | err_i.append(err_ij) 37 | res.append(res_i) 38 | err.append(err_i) 39 | 40 | x=[0.1,0.2,0.4,0.8,1.6,3.2,6.4,12.8] 41 | fig, axes = plt.subplots(1,4, figsize=(36, 5)) 42 | 43 | axes[0].tick_params(axis='both', which='major', labelsize=15) 44 | axes[0].set_facecolor("white") 45 | axes[0].axhline(y=res[0],ls="--",c='black',alpha=0.6,label='Query result') 46 | axes[0].plot(x, err[0][0],linewidth = 2.5, linestyle = '-.',label='R2T', 47 | marker = 's',markersize = 8,color=plt.cm.tab20c(0), 48 | markeredgecolor=plt.cm.tab20c(0),markeredgewidth = 1,markerfacecolor=plt.cm.tab20c(0)) 49 | axes[0].plot(x, err[0][1],linewidth = 2.5,linestyle = '-.',label='LP', 50 | marker = 's',markersize = 8,color=plt.cm.tab20c(12), 51 | markeredgecolor=plt.cm.tab20c(12),markeredgewidth = 2,markerfacecolor='w') 52 | axes[0].plot(x, err[0][3],linewidth = 2.5, linestyle = '--',label='NT', 53 | marker = 'v',markersize = 8,color=plt.cm.tab20c(6), 54 | markeredgecolor=plt.cm.tab20c(6),markeredgewidth = 2,markerfacecolor=plt.cm.tab20c(6)) 55 | axes[0].plot(x, err[0][4],linewidth = 2.5,linestyle = '--',label='SDE', 56 | marker = 'v',markersize = 8,color=plt.cm.tab20b(8), 57 | markeredgecolor=plt.cm.tab20b(8),markeredgewidth = 2,markerfacecolor='w') 58 | axes[0].set_yscale('log') 59 | axes[0].set_xscale('log') 60 | axes[0].set_title('Edge counting',fontsize=23) 61 | axes[0].set_ylabel("Error Level",fontsize=23) 62 | axes[0].set_xlabel(r"value of $\epsilon$",fontsize=23) 63 | 64 | axes[1].tick_params(axis='both', which='major', labelsize=15) 65 | axes[1].set_facecolor("white") 66 | axes[1].axhline(y=res[1],ls="--",c='black',alpha=0.6,label='Query result') 67 | axes[1].plot(x, err[1][0],linewidth = 2.5, linestyle = '-.',label='R2T', 68 | marker = 's',markersize = 8,color=plt.cm.tab20c(0), 69 | markeredgecolor=plt.cm.tab20c(0),markeredgewidth = 1,markerfacecolor=plt.cm.tab20c(0)) 70 | axes[1].plot(x, err[1][1],linewidth = 2.5,linestyle = '-.',label='LP', 71 | marker = 's',markersize = 8,color=plt.cm.tab20c(12), 72 | markeredgecolor=plt.cm.tab20c(12),markeredgewidth = 2,markerfacecolor='w') 73 | axes[1].plot(x, err[1][3],linewidth = 2.5, linestyle = '--',label='NT', 74 | marker = 'v',markersize = 8,color=plt.cm.tab20c(6), 75 | markeredgecolor=plt.cm.tab20c(6),markeredgewidth = 2,markerfacecolor=plt.cm.tab20c(6)) 76 | axes[1].plot(x, err[1][4],linewidth = 2.5,linestyle = '--',label='SDE', 77 | marker = 'v',markersize = 8,color=plt.cm.tab20b(8), 78 | markeredgecolor=plt.cm.tab20b(8),markeredgewidth = 2,markerfacecolor='w') 79 | axes[1].set_yscale('log') 80 | axes[1].set_xscale('log') 81 | axes[1].set_title('Length-2 path counting',fontsize=23) 82 | axes[1].set_xlabel(r"value of $\epsilon$",fontsize=23) 83 | 84 | axes[2].tick_params(axis='both', which='major', labelsize=15) 85 | axes[2].set_facecolor("white") 86 | axes[2].axhline(y=res[2],ls="--",c='black',alpha=0.6,label='Query result') 87 | axes[2].plot(x, err[2][1],linewidth = 2.5,linestyle = '-.',label='LP', 88 | marker = 's',markersize = 8,color=plt.cm.tab20c(12), 89 | markeredgecolor=plt.cm.tab20c(12),markeredgewidth = 2,markerfacecolor='w') 90 | axes[2].plot(x, err[2][2],linewidth = 2.5,linestyle = ':',label='Rec', 91 | marker = 'o',markersize = 8,color=plt.cm.tab20c(9), 92 | markeredgecolor=plt.cm.tab20c(9),markeredgewidth = 1,markerfacecolor=plt.cm.tab20c(9)) 93 | axes[2].plot(x, err[2][3],linewidth = 2.5, linestyle = '--',label='NT', 94 | marker = 'v',markersize = 8,color=plt.cm.tab20c(6), 95 | markeredgecolor=plt.cm.tab20c(6),markeredgewidth = 2,markerfacecolor=plt.cm.tab20c(6)) 96 | axes[2].plot(x, err[2][4],linewidth = 2.5,linestyle = '--',label='SDE', 97 | marker = 'v',markersize = 8,color=plt.cm.tab20b(8), 98 | markeredgecolor=plt.cm.tab20b(8),markeredgewidth = 2,markerfacecolor='w') 99 | axes[2].plot(x, err[2][0],linewidth = 2.5, linestyle = '-.',label='R2T', 100 | marker = 's',markersize = 8,color=plt.cm.tab20c(0), 101 | markeredgecolor=plt.cm.tab20c(0),markeredgewidth = 1,markerfacecolor=plt.cm.tab20c(0)) 102 | axes[2].set_yscale('log') 103 | axes[2].set_xscale('log') 104 | axes[2].set_title('Triangle counting',fontsize=23) 105 | axes[2].set_xlabel(r"value of $\epsilon$",fontsize=23) 106 | 107 | axes[3].tick_params(axis='both', which='major', labelsize=15) 108 | axes[3].set_facecolor("white") 109 | axes[3].axhline(y=res[3],ls="--",c='black',alpha=0.6,label='Query result') 110 | axes[3].plot(x, err[3][1],linewidth = 2.5,linestyle = '-.',label='LP', 111 | marker = 's',markersize = 8,color=plt.cm.tab20c(12), 112 | markeredgecolor=plt.cm.tab20c(12),markeredgewidth = 2,markerfacecolor='w') 113 | axes[3].plot(x, err[3][2],linewidth = 2.5,linestyle = ':',label='Rec', 114 | marker = 'o',markersize = 8,color=plt.cm.tab20c(9), 115 | markeredgecolor=plt.cm.tab20c(9),markeredgewidth = 1,markerfacecolor=plt.cm.tab20c(9)) 116 | axes[3].plot(x, err[3][3],linewidth = 2.5, linestyle = '--',label='NT', 117 | marker = 'v',markersize = 8,color=plt.cm.tab20c(6), 118 | markeredgecolor=plt.cm.tab20c(6),markeredgewidth = 2,markerfacecolor=plt.cm.tab20c(6)) 119 | axes[3].plot(x, err[3][4],linewidth = 2.5,linestyle = '--',label='SDE', 120 | marker = 'v',markersize = 8,color=plt.cm.tab20b(8), 121 | markeredgecolor=plt.cm.tab20b(8),markeredgewidth = 2,markerfacecolor='w') 122 | axes[3].plot(x, err[3][0],linewidth = 2.5, linestyle = '-.',label='R2T', 123 | marker = 's',markersize = 8,color=plt.cm.tab20c(0), 124 | markeredgecolor=plt.cm.tab20c(0),markeredgewidth = 1,markerfacecolor=plt.cm.tab20c(0)) 125 | axes[3].set_yscale('log') 126 | axes[3].set_xscale('log') 127 | axes[3].set_title('Rectangle counting',fontsize=23) 128 | axes[3].set_xlabel(r"value of $\epsilon$",fontsize=23) 129 | axes[3].legend(bbox_to_anchor=(-3.7, 0.46, 1, 1),fontsize=19,ncol=3, facecolor="white") 130 | plt.savefig(cur_path+"/../Figure/Eps.pdf") 131 | 132 | if __name__ == "__main__": 133 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /Code/ExtractInfo.py: -------------------------------------------------------------------------------- 1 | import getopt 2 | import psycopg2 3 | import sys 4 | 5 | def ReadQuery(): 6 | global query 7 | global query_path 8 | 9 | query = "" 10 | query_file = open(query_path,'r') 11 | 12 | # Read the query file and store in query 13 | for line in query_file.readlines(): 14 | query = query + line 15 | if ";" in query: 16 | query = query.replace('\n'," ") 17 | break 18 | 19 | def ReadPrimaryKey(): 20 | global primary_key_list 21 | global primary_key_path 22 | 23 | # Read and store the primary key(s) of the private relation 24 | key_list_file = open(primary_key_path,'r') 25 | line = key_list_file.readline() 26 | primary_key_list = line.split() 27 | 28 | def RewriteQuery(): 29 | global query 30 | global private_relation_name 31 | global rewrite_query 32 | global primary_key_list 33 | global renaming_private_relations 34 | 35 | # Split the query into select, from and where clauses 36 | #Match the corresponding terms 37 | from_string = "" 38 | select_string = "" 39 | where_string = "" 40 | query_t = query.replace(","," ") 41 | words = query_t.split(" ") 42 | 43 | for word in words: 44 | if word.lower() == "select": 45 | select_string = word 46 | if word.lower() == "from": 47 | from_string = word 48 | if word.lower() == "where": 49 | where_string = word 50 | 51 | parser_string = query 52 | parser_string = parser_string.replace(select_string + " ", "") 53 | parser_string = parser_string.replace(from_string + " ", "\n") 54 | parser_string = parser_string.replace(where_string + " ", "\n") 55 | parser_string = parser_string.replace(";", "") 56 | parser_strings = parser_string.split("\n") 57 | 58 | select_strings = parser_strings[0] 59 | from_strings = parser_strings[1] 60 | where_strings = parser_strings[2] 61 | 62 | # Split the select attributes 63 | select_strings = select_strings.replace(",", "\n") 64 | select_strings = select_strings.split("\n") 65 | 66 | # Split the relations 67 | relations_strings = from_strings.replace(",", "\n") 68 | relations_strings = relations_strings.split("\n") 69 | 70 | # Renaming_private_relations stores all the relations that are private 71 | renaming_private_relations = [] 72 | 73 | # Go through the relations in the from clause 74 | for relations_string in relations_strings: 75 | relations_string = relations_string.split() 76 | origin_relation = relations_string[0] 77 | 78 | # Case 1: there is a renaming, xxx as xxx 79 | if len(relations_string) > 1: 80 | renaming_relation = relations_string[2] 81 | # Case 2: there is no renaming 82 | else: 83 | renaming_relation = relations_string[0] 84 | 85 | # Append the private relations to the list 86 | if origin_relation == private_relation_name: 87 | renaming_private_relations.append(renaming_relation) 88 | 89 | # Rewrite the query 90 | rewrite_query = "select " 91 | # Case 1: aggregation query 92 | if "sum" in select_strings[0]: 93 | if " as " in select_strings[0]: 94 | select_strings[0] = select_strings[0].replace(" as ", "\n").split("\n")[0] 95 | 96 | rewrite_query = rewrite_query + select_strings[0][select_strings[0].find('(') + 1 : select_strings[0].rfind(')')] + ", " 97 | # Case 2: counting query 98 | else: 99 | rewrite_query = rewrite_query + "1, " 100 | 101 | # Go through all the private relations 102 | for i in range(len(renaming_private_relations)): 103 | concat_attr = "" 104 | 105 | # Concatenate all the private key(s) as the attribbute 106 | for j in range(len(primary_key_list)): 107 | if j == 0: 108 | concat_attr = "concat(" + renaming_private_relations[i] + "." + primary_key_list[j] + ",\',\')" 109 | else: 110 | concat_attr = concat_attr + "||concat(" + renaming_private_relations[i] + "." + primary_key_list[j] + ",\',\')" 111 | 112 | concat_attr = concat_attr + " as id" + str(i) 113 | 114 | # Add the private relation to select clause 115 | if i == 0: 116 | rewrite_query = rewrite_query + concat_attr 117 | else: 118 | rewrite_query = rewrite_query + ", " + concat_attr 119 | 120 | # Combine all the parts of the rewrite query 121 | rewrite_query = rewrite_query + " from " + from_strings + " where " + where_strings + ";" 122 | 123 | def ExtractRelationship(): 124 | global database_name 125 | global rewrite_query 126 | global output_file 127 | global renaming_private_relations 128 | 129 | con = psycopg2.connect(database=database_name) 130 | cur = con.cursor() 131 | 132 | # Run the query and get the results 133 | cur.execute(rewrite_query) 134 | res = cur.fetchall() 135 | 136 | id_dic = {} 137 | results = open(output_file, 'w') 138 | num_id = 0 139 | 140 | # Go through the results 141 | for i in range(len(res)): 142 | temp_res = res[i] 143 | # Write the count/aggregation result 144 | results.write(str(temp_res[0]) + " ") 145 | 146 | # Write the private relations in the result 147 | for j in range(1, len(renaming_private_relations) + 1): 148 | temp_id = temp_res[j] 149 | 150 | # Reordering the private relations 151 | if temp_id in id_dic: 152 | results.write(str(id_dic[temp_id]) + " ") 153 | else: 154 | id_dic[temp_id] = num_id 155 | results.write(str(num_id) + " ") 156 | num_id += 1 157 | 158 | results.write("\n") 159 | 160 | con.commit() 161 | con.close() 162 | 163 | def main(argv): 164 | # Name of the database to be queried 165 | global database_name 166 | # Path of the txt file storing the query 167 | global query_path 168 | # Name of the private relation 169 | global private_relation_name 170 | # Path of the txt file storing the primary key(s) of the private relation 171 | global primary_key_path 172 | # Path of the output file of the query results 173 | global output_file 174 | 175 | try: 176 | opts, args = getopt.getopt(argv,"h:D:Q:P:K:O:",["Database=","QueryPath=","PrivateRelationName=","PrimaryKey=","Output="]) 177 | except getopt.GetoptError: 178 | print("ExtractInfo.py -D -Q -P -K -O ") 179 | sys.exit(2) 180 | for opt, arg in opts: 181 | if opt == '-h': 182 | print("ExtractInfo.py -D -Q -P -K -O ") 183 | sys.exit() 184 | elif opt in ("-D", "--Database"): 185 | database_name = arg 186 | elif opt in ("-Q","--QueryPath"): 187 | query_path = arg 188 | elif opt in ("-P","--PrivateRelationName"): 189 | private_relation_name = arg 190 | elif opt in ("-K","--PrimaryKey"): 191 | primary_key_path=arg 192 | elif opt in ("-O","--Output"): 193 | output_file=arg 194 | 195 | ReadQuery() 196 | ReadPrimaryKey() 197 | RewriteQuery() 198 | ExtractRelationship() 199 | 200 | if __name__ == "__main__": 201 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /Code/SystemExtractInfo.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import getopt 3 | import psycopg2 4 | import sys 5 | 6 | 7 | 8 | def ReadQuery(): 9 | global query 10 | global query_path 11 | query = "" 12 | query_file = open(query_path,'r') 13 | # Read the query file and store in query 14 | for line in query_file.readlines(): 15 | query = query + line 16 | if ";" in query: 17 | query = query.replace('\n'," ") 18 | break 19 | 20 | 21 | 22 | def ReadPrimaryRelation(): 23 | global private_relation_path 24 | global primary_relation_list 25 | primary_relation_list = [] 26 | input_file = open(private_relation_path,'r') 27 | for line in input_file.readlines(): 28 | line = line.replace('\n',"") 29 | primary_relation_list.append(line) 30 | 31 | 32 | 33 | def ReadPrimaryKey(): 34 | global key_path 35 | global key_list 36 | global primary_relation_list 37 | key_list = {} 38 | input_file = open(key_path,'r') 39 | i = 0 40 | for line in input_file.readlines(): 41 | line = line.replace('\n',"") 42 | elements = line.split() 43 | key_list[primary_relation_list[i]]=elements 44 | i+=1 45 | 46 | 47 | 48 | def RewriteQuery(): 49 | global query 50 | global rewrite_query 51 | global key_list 52 | global primary_relation_list 53 | global colum_num 54 | 55 | # Split the query into select, from and where clauses 56 | #Match the corresponding terms 57 | from_string = "" 58 | select_string = "" 59 | where_string = "" 60 | query_t = query.replace(","," ") 61 | words = query_t.split(" ") 62 | 63 | for word in words: 64 | if word.lower() == "select": 65 | select_string = word 66 | if word.lower() == "from": 67 | from_string = word 68 | if word.lower() == "where": 69 | where_string = word 70 | 71 | parser_string = query 72 | parser_string = parser_string.replace(select_string + " ", "") 73 | parser_string = parser_string.replace(from_string + " ", "\n") 74 | parser_string = parser_string.replace(where_string + " ", "\n") 75 | parser_string = parser_string.replace(";", "") 76 | parser_strings = parser_string.split("\n") 77 | select_strings = parser_strings[0] 78 | from_strings = parser_strings[1] 79 | where_strings = parser_strings[2] 80 | 81 | # Split the select attributes 82 | select_strings = select_strings.replace(",", "\n") 83 | select_strings = select_strings.split("\n") 84 | 85 | # Split the relations 86 | relations_strings = from_strings.replace(",", "\n") 87 | relations_strings = relations_strings.split("\n") 88 | 89 | # Renaming_private_relations stores all the relations that are private 90 | renaming_private_relations = {} 91 | for primary_relation in primary_relation_list: 92 | renaming_private_relations[primary_relation] = [] 93 | 94 | # Go through the relations in the from clause 95 | for relations_string in relations_strings: 96 | relations_string = relations_string.split() 97 | origin_relation = relations_string[0] 98 | # Case 1: there is a renaming, xxx as xxx 99 | if len(relations_string) > 1: 100 | renaming_relation = relations_string[2] 101 | # Case 2: there is no renaming 102 | else: 103 | renaming_relation = relations_string[0] 104 | if origin_relation in primary_relation_list: 105 | renaming_private_relations[origin_relation].append(renaming_relation) 106 | 107 | # Rewrite the query 108 | rewrite_query = "select " 109 | # Case 1: aggregation query 110 | if "sum" in select_strings[0]: 111 | if " as " in select_strings[0]: 112 | select_strings[0] = select_strings[0].replace(" as ", "\n").split("\n")[0] 113 | rewrite_query = rewrite_query + select_strings[0][select_strings[0].find('(') + 1 : select_strings[0].rfind(')')] + ", " 114 | # Case 2: counting query 115 | else: 116 | rewrite_query = rewrite_query + "1, " 117 | 118 | select_part = "" 119 | i = 0 120 | colum_num = 0 121 | # Go through all the private relations 122 | for primary_relation in primary_relation_list: 123 | for renaming_name in renaming_private_relations[primary_relation]: 124 | colum_num+=1 125 | if i>0: 126 | select_part =select_part+", " 127 | select_part = select_part+"'"+primary_relation+"'" 128 | for key in key_list[primary_relation]: 129 | select_part = select_part + "||concat(" + renaming_name + "." + key + ",\',\')" 130 | select_part = select_part + " as id" + str(i) 131 | i+=1 132 | rewrite_query = rewrite_query +" "+select_part+ " from " + from_strings + " where " + where_strings + ";" 133 | 134 | 135 | 136 | def ExtractRelationship(): 137 | global database_name 138 | global rewrite_query 139 | global output_path 140 | global renaming_private_relations 141 | global colum_num 142 | con = psycopg2.connect(database=database_name) 143 | cur = con.cursor() 144 | # Run the query and get the results 145 | cur.execute(rewrite_query) 146 | res = cur.fetchall() 147 | id_dic = {} 148 | results = open(output_path, 'w') 149 | num_id = 0 150 | # Go through the results 151 | for i in range(len(res)): 152 | temp_res = res[i] 153 | # Write the count/aggregation result 154 | results.write(str(temp_res[0]) + " ") 155 | # Write the private relations in the result 156 | for j in range(1, colum_num + 1): 157 | temp_id = temp_res[j] 158 | # Reordering the private relations 159 | if temp_id in id_dic: 160 | results.write(str(id_dic[temp_id]) + " ") 161 | else: 162 | id_dic[temp_id] = num_id 163 | results.write(str(num_id) + " ") 164 | num_id += 1 165 | results.write("\n") 166 | con.commit() 167 | con.close() 168 | 169 | 170 | 171 | def main(argv): 172 | # Name of the database to be queried 173 | global database_name 174 | # Path of the txt file storing the query 175 | global query_path 176 | # Path of file of the private relation 177 | global private_relation_path 178 | # Path of the file of primary keys 179 | global key_path 180 | # Path of the output file of the query results 181 | global output_path 182 | try: 183 | opts, args = getopt.getopt(argv,"h:D:Q:P:K:O:",["Database=","QueryPath=","PrivateRelationPath=","KetPath","Output="]) 184 | except getopt.GetoptError: 185 | print("SystemExtractInfo.py -D -Q -P -K -O ") 186 | sys.exit(2) 187 | for opt, arg in opts: 188 | if opt == '-h': 189 | print("SystemExtractInfo.py -D -Q -P -K -O ") 190 | sys.exit() 191 | elif opt in ("-D", "--Database"): 192 | database_name = arg 193 | elif opt in ("-Q","--QueryPath"): 194 | query_path = arg 195 | elif opt in ("-P","--PrivateRelationPath"): 196 | private_relation_path = arg 197 | elif opt in ("-K","--KeyPath"): 198 | key_path = arg 199 | elif opt in ("-O","--Output"): 200 | output_path=arg 201 | ReadQuery() 202 | ReadPrimaryRelation() 203 | ReadPrimaryKey() 204 | RewriteQuery() 205 | ExtractRelationship() 206 | 207 | 208 | 209 | if __name__ == "__main__": 210 | main(sys.argv[1:]) -------------------------------------------------------------------------------- /Script/CollectResultsSDE.py: -------------------------------------------------------------------------------- 1 | import getopt 2 | import math 3 | import os 4 | import random 5 | import sys 6 | import time 7 | 8 | repeat_times = 10 9 | trials = 1000 10 | 11 | epsilons = [0.1, 0.2, 0.4, 0.8, 1.6, 3.2, 6.4, 12.8] 12 | graphs = ["Amazon2", "Amazon1", "RoadnetPA", "RoadnetCA", "Deezer"] 13 | ks = ["one_path", "triangle", "two_path", "rectangle"] 14 | 15 | def RestrictedSensitivity(theta, k): 16 | theta_ = 2 * theta 17 | 18 | if k == 0: # edge 19 | return theta_ 20 | elif k == 1: # triangle 21 | return theta_ * (theta_ - 1) / 2 22 | elif k == 2: # rectangle 23 | return theta_ * (theta_ - 1) * (theta_ - 1) / 2 24 | elif k == 3: # two triangle 25 | return theta_ * (theta_ - 1) * (theta_ - 2) 26 | elif k == 4: # two path 27 | return theta_ * (theta_ - 1) * 3 / 2 28 | else: 29 | return 0 30 | 31 | def SS(distance_estimator, epsilon, theta, k): 32 | base = math.e 33 | beta = epsilon / 10 34 | 35 | round_distance_estimator = math.ceil(distance_estimator) 36 | s_max = math.pow(base, - beta / 4 * (round_distance_estimator - distance_estimator)) * (2 * round_distance_estimator + 5) * RestrictedSensitivity(theta, k) 37 | 38 | d_1 = math.floor(4 / beta - 5 / 2) 39 | d_2 = math.ceil(4 / beta - 5 / 2) 40 | 41 | if d_1 >= distance_estimator: 42 | s = math.pow(base, - beta / 4 * (d_1 - distance_estimator)) * (2 * d_1 + 5) * RestrictedSensitivity(theta, k) 43 | if s > s_max: 44 | s_max = s 45 | 46 | if d_2 >= distance_estimator: 47 | s = math.pow(base, - beta / 4 * (d_2 - distance_estimator)) * (2 * d_2 + 5) * RestrictedSensitivity(theta, k) 48 | if s > s_max: 49 | s_max = s 50 | 51 | return s_max 52 | 53 | def CauchyCum(x): 54 | a = 1/4/math.sqrt(2)*(math.log(abs(x**2+math.sqrt(2)*x+1))+2*math.atan(math.sqrt(2)*x+1)) 55 | a += 1/4/math.sqrt(2)*(-math.log(abs(x**2-math.sqrt(2)*x+1))+2*math.atan(math.sqrt(2)*x-1)) 56 | 57 | return a 58 | 59 | def CauNoise(): 60 | a = random.uniform(0,math.pi/2/math.sqrt(2)) 61 | 62 | left = 0 63 | right = 6000 64 | mid = (left + right) / 2.0 65 | 66 | while(abs(CauchyCum(mid) - a) > 0.000001): 67 | if CauchyCum(mid) > a: 68 | right = mid 69 | else: 70 | left = mid 71 | mid = (left + right) / 2.0 72 | 73 | c = random.uniform(0, 1) 74 | 75 | if c > 0.5: 76 | return mid 77 | else: 78 | return -mid 79 | 80 | def main(argv): 81 | global repeat_times 82 | global trials 83 | global epsilons 84 | global graphs 85 | global ks 86 | 87 | try: 88 | opts, args = getopt.getopt(argv,"h:G:Q:e:",["Graph=","Query=","epsilon="]) 89 | except getopt.GetoptError: 90 | print("CollectResultsSDE.py -G -Q -e ") 91 | sys.exit(2) 92 | for opt, arg in opts: 93 | if opt == "-h": 94 | print("CollectResultsSDE.py -G -Q -e ") 95 | sys.exit() 96 | elif opt in ("-G", "--Graph"): 97 | if str(arg) in graphs: 98 | graphs = [str(arg)] 99 | elif opt in ("-Q", "--Query"): 100 | if str(arg) in ks: 101 | ks = [str(arg)] 102 | elif opt in ("-e", "--epsilon"): 103 | if float(arg) in epsilons: 104 | epsilons = [float(arg)] 105 | 106 | lp_time_dict = {} 107 | count_time_dict = {} 108 | error_time_dict = {} 109 | 110 | dist_dict = {} 111 | count_dict = {} 112 | ss_dict = {} 113 | 114 | cur_path = os.getcwd() 115 | 116 | for graph in graphs: 117 | if graph == "Amazon2": 118 | thetas = [1024.0, 512.0, 256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0] 119 | lp_thetas = [1024.0, 512.0, 256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0] 120 | fail_thetas = [] 121 | max_theta = 1024.0 122 | min_theta = 2.0 123 | elif graph == "Amazon1": 124 | thetas = [1024.0, 512.0, 256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0] 125 | lp_thetas = [1024.0, 512.0, 256.0, 128.0, 64.0, 32.0, 16.0, 8.0] 126 | fail_thetas = [4.0, 2.0] 127 | max_theta = 1024.0 128 | min_theta = 8.0 129 | elif graph == "Deezer": 130 | thetas = [1024.0, 512.0, 256.0, 128.0, 64.0, 32.0, 16.0, 8.0, 4.0, 2.0] 131 | lp_thetas = [1024.0, 512.0, 256.0, 128.0, 64.0, 32.0] 132 | fail_thetas = [16.0, 8.0, 4.0, 2.0] 133 | max_theta = 1024.0 134 | min_theta = 32.0 135 | else: 136 | thetas = [16.0, 8.0, 4.0, 2.0] 137 | lp_thetas = [16.0, 8.0, 4.0, 2.0] 138 | fail_thetas = [] 139 | max_theta = 16.0 140 | min_theta = 2.0 141 | 142 | for theta in lp_thetas: 143 | cmd = "python " + cur_path + "/../Code/SDE.py -I " + cur_path + "/../Information/Graph/one_path/" + graph + ".txt -e 0.8 -t " + str(int(theta)) + " -k 0 -D SDE_" + graph + " -m 1" 144 | 145 | shell = os.popen(cmd, 'r') 146 | res = shell.read() 147 | res = res.split() 148 | 149 | distance_estimator = float(res[2]) 150 | time_ = float(res[4]) 151 | 152 | dist_dict[(graph, theta)] = distance_estimator 153 | lp_time_dict[(graph, theta)] = time_ 154 | 155 | for i in range(len(ks)): 156 | query = ks[i] 157 | 158 | cmd = "python " + cur_path + "/../Code/SDE.py -I " + cur_path + "/../Information/Graph/one_path/" + graph + ".txt -e 0.8 -t " + str(int(theta)) + " -k 0 -D SDE_" + graph + " -m 2" 159 | 160 | sum_time = 0 161 | 162 | for j in range(repeat_times): 163 | shell = os.popen(cmd, 'r') 164 | res = shell.read() 165 | res = res.split() 166 | 167 | count = int(float(res[1])) 168 | time_ = float(res[3]) 169 | 170 | count_dict[(graph, theta, query)] = count 171 | sum_time += time_ 172 | 173 | count_time_dict[(graph, theta, query)] = sum_time / repeat_times 174 | 175 | for epsilon in epsilons: 176 | sum_time = 0 177 | 178 | for j in range(repeat_times): 179 | start = time.time() 180 | 181 | ss_dict[(graph, theta, query, epsilon)] = SS(dist_dict[(graph, theta)], epsilon, theta, i) 182 | result = count_dict[(graph, theta, query)] + CauNoise() * 10 * ss_dict[(graph, theta, query, epsilon)] / epsilon 183 | 184 | end = time.time() 185 | 186 | sum_time += end - start 187 | 188 | error_time_dict[(graph, theta, query, epsilon)] = sum_time / repeat_times 189 | 190 | time_dict = {} 191 | 192 | for i in range(len(ks)): 193 | query = ks[i] 194 | 195 | output_file = open(cur_path + "/../Result/Graph/SDE_" + query + "_" + graph + ".txt", 'w') 196 | 197 | for epsilon in epsilons: 198 | for theta in lp_thetas: 199 | time_dict[(graph, theta, query, epsilon)] = lp_time_dict[(graph, theta)] + count_time_dict[(graph, theta, query)] + error_time_dict[(graph, theta, query, epsilon)] 200 | 201 | for theta in fail_thetas: 202 | time_dict[(graph, theta, query, epsilon)] = 21600.0 203 | 204 | errors = [] 205 | count_fail = 0 206 | 207 | for j in range(trials): 208 | random_theta = random.choice(thetas) 209 | 210 | if random_theta < min_theta: 211 | count_fail += 1 212 | real_count = count_dict[(graph, max_theta, query)] 213 | 214 | errors.append(1e20) 215 | else: 216 | result = count_dict[(graph, random_theta, query)] + CauNoise() * 10 * ss_dict[(graph, random_theta, query, epsilon)] / epsilon 217 | real_count = count_dict[(graph, max_theta, query)] 218 | 219 | error = abs(result - real_count) 220 | errors.append(error) 221 | 222 | errors.sort() 223 | 224 | sum_time = 0 225 | 226 | for theta in thetas: 227 | sum_time += time_dict[(graph, theta, query, epsilon)] 228 | 229 | average_time = sum_time / len(thetas) 230 | 231 | if count_fail < int(float(trials * 0.2)): 232 | output_file.write(str(epsilon) + " " + str(real_count) + " " + str(sum(errors[int(float(trials * 0.2)) : trials - int(float(trials * 0.2))]) / int(float(trials * 0.6))) + " " + str(average_time) + "\n") 233 | else: 234 | output_file.write(str(epsilon) + " " + str(real_count) + " " + str(sum(errors[count_fail: trials - count_fail]) / (trials - 2 * count_fail)) + " " + str(average_time) + "\n") 235 | 236 | if __name__ == "__main__": 237 | main(sys.argv[1:]) --------------------------------------------------------------------------------