Abstract
We use randomness to exploit the potential sparsity of the Boolean matrix product in order to speed up the computation of the product. Our new fast output-sensitive algorithm for Boolean matrix product and its witnesses is randomized and provides the Boolean product and its witnesses almost certainly. Its worst-case time performance is expressed in terms of the input size and the number of non-zero entries of the product matrix. It runs in time \(\widetilde{O}(n^{2}s^{\omega/2-1})\), where the input matrices have size n×n, the number of non-zero entries in the product matrix is at most s, ω is the exponent of the fast matrix multiplication and \(\widetilde{O}(f(n))\) denotes O(f(n)log d n) for some constant d. By the currently best bound on ω, its running time can be also expressed as \(\widetilde{O}(n^{2}s^{0.188})\). Our algorithm is substantially faster than the output-sensitive column-row method for Boolean matrix product for s larger than n 1.232 and it is never slower than the fast \(\widetilde{O}(n^{\omega})\)-time algorithm for this problem. By applying the fast rectangular matrix multiplication, we can refine our upper bound further to the form \(\widetilde{O}(n^{\omega(\frac{1}{2}\log_{n}s,1,1)})\), where ω(p,q,t) is the exponent of the fast multiplication of an n p×n q matrix by an n q×n t matrix.
We also present a partial derandomization of our algorithm as well as its generalization to include the Boolean product of rectangular Boolean matrices. Finally, we show several applications of our output-sensitive algorithms.
Similar content being viewed by others
References
Agrawal, M., Kayal, N., Saxena, N.: PRIMES is in P. Ann. Math. 160(2), 781–793 (2004)
Alon, N., Naor, M.: Derandomization, witnesses for Boolean matrix multiplication and construction of perfect hash functions. Algorithmica 16, 434–449 (1996)
Alon, N., Matias, Y., Szegedy, M.: The space complexity of approximating the frequency moments. In: Proc. STOC 1996, pp. 20–29 (1996)
Amossen, R.R., Pagh, R.: Faster join-projects and sparse matrix multiplication. In: Proc. ACM International Conference on Database Theory (ICDT 2009), St. Petersburg, pp. 121–126, March 2009
Arlazow, V.L., Dinic, E.A., Kronrod, M.A., Faradzev, I.A.: On economical construction of the transitive closure of an oriented graph. Sov. Math. Dokl. 11, 1209–1210 (1970)
Bash, J., Khanna, S., Motwani, R.: On diameter verification and Boolean matrix multiplication. Technical Report, Stanford University CS department (1995)
Broder, A.Z., Charikar, M., Frieze, A.M., Mitzenmacher, M.: Min-wise independent permutations. J. Comput. Syst. Sci. 60, 630–659 (2000)
Chor, B., Goldreich, O.: On the power of two-point sampling. J. Complex. 5, 96–106 (1989)
Cohen, E.: Estimating the size of the transitive closure in linear time. In: Proc. FOCS 1994, pp. 190–200 (1994)
Cohen, E.: Structure prediction and computation of sparse matrix products. J. Comb. Optim. 2, 307–332 (1999)
Coppersmith, D.: Rectangular matrix multiplication revisited. J. Symb. Comput. 13, 42–49 (1997)
Coppersmith, D., Winograd, S.: Matrix multiplication via arithmetic progressions. J. Symb. Comput. 9, 251–280 (1990)
Czumaj, A., Kowaluk, M., Lingas, A.: Faster algorithms for finding lowest common ancestors in directed acyclic graphs. Theor. Comput. Sci. 380(1–2), 37–46 (2007). The special ICALP 2005 issue
Galil, Z., Margalit, O.: Witnesses for Boolean matrix multiplication and shortest paths. J. Complex. 417–426 (1993)
George, A., Gilbert, J., Liu, J.W.H. (eds.): Graph Theory and Sparse Matrix Computation. The IMA Volumes in Mathematics and Its Applications, vol. 56. Springer, Berlin (1993)
Golub, G., Van Loan, C. (eds.): Matrix Computations. Johns Hopkins University Press, Baltimore (1989)
Huang, X., Pan, V.Y.: Fast rectangular matrix multiplications and applications. J. Complex. 14, 257–299 (1998)
Joffe, A.: On a set of almost deterministic k-independent random variables. Ann. Probab. 2, 161–162 (1974)
Kowaluk, M., Lingas, A.: LCA queries in directed acyclic graphs. In: Proc. ICALP 2005. Lecture Notes in Computer Science, vol. 3580, pp. 241–248. Springer, Berlin (2005)
Mehlhorn, K., Galil, Z.: Monotone switching circuits and Boolean matrix product. In: Proc. MFCS 1975, pp. 315–319 (1975)
Munro, J.I.: Efficient determination of the transitive closure of a directed graph. Inf. Process. Lett. 1(2), 56–58 (1971)
Paterson, M.: Complexity of monotone networks for Boolean matrix product. Theor. Comput. Sci. 1(1), 13–20 (1975)
Pratt, V.R.: The power of negative thinking in multiplying Boolean matrices. SIAM J. Comput. 4(3), 326–330 (1975)
Rytter, W.: Fast recognition of pushdown automaton and context-free languages. Inf. Control 67(1–3), 12–22 (1985)
Shapira, A., Yuster, R., Zwick, U.: All-pairs bottleneck paths in vertex weighted graphs. In: Proc. SODA 2007, pp. 978–985 (2007)
Seidel, R.: On the all-pairs-shortest-path problem. In: Proc. 24th Annual ACM Symposium on Theory of Computing, pp. 745–749 (1992)
Schnorr, C.P., Subramanian, C.R.: Almost optimal (on the average) combinatorial algorithms for Boolean matrix product witnesses, computing the diameter. In: Randomization and Approximation Techniques in Computer Science, Second International Workshop, RANDOM’98. Lecture Notes in Computer Science, vol. 1518, pp. 218–231. Springer, Berlin (1998)
Vassilevska Williams, V., Williams, R.: Subcubic equivalences between path, matrix, and triangle problems. In: Proc. FOCS 2010 (to appear)
Yuster, R., Zwick, U.: Fast sparse matrix multiplication. ACM Trans. Algorithms (TALG) 1(1) (2005). Preliminary version in Proc. ESA (2004)
Author information
Authors and Affiliations
Corresponding author
Additional information
Preliminary version in Proc. ESA 09. Research supported in part by the VR grant 621-2005-4085.
Rights and permissions
About this article
Cite this article
Lingas, A. A Fast Output-Sensitive Algorithm for Boolean Matrix Multiplication. Algorithmica 61, 36–50 (2011). https://doi.org/10.1007/s00453-010-9441-x
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00453-010-9441-x