Skip to main content
Log in

A Fast Output-Sensitive Algorithm for Boolean Matrix Multiplication

  • Published:
Algorithmica Aims and scope Submit manuscript

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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Agrawal, M., Kayal, N., Saxena, N.: PRIMES is in P. Ann. Math. 160(2), 781–793 (2004)

    Article  MathSciNet  MATH  Google Scholar 

  2. Alon, N., Naor, M.: Derandomization, witnesses for Boolean matrix multiplication and construction of perfect hash functions. Algorithmica 16, 434–449 (1996)

    Article  MathSciNet  MATH  Google Scholar 

  3. Alon, N., Matias, Y., Szegedy, M.: The space complexity of approximating the frequency moments. In: Proc. STOC 1996, pp. 20–29 (1996)

  4. 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

  5. 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)

    Google Scholar 

  6. Bash, J., Khanna, S., Motwani, R.: On diameter verification and Boolean matrix multiplication. Technical Report, Stanford University CS department (1995)

  7. Broder, A.Z., Charikar, M., Frieze, A.M., Mitzenmacher, M.: Min-wise independent permutations. J. Comput. Syst. Sci. 60, 630–659 (2000)

    Article  MathSciNet  MATH  Google Scholar 

  8. Chor, B., Goldreich, O.: On the power of two-point sampling. J. Complex. 5, 96–106 (1989)

    Article  MathSciNet  MATH  Google Scholar 

  9. Cohen, E.: Estimating the size of the transitive closure in linear time. In: Proc. FOCS 1994, pp. 190–200 (1994)

  10. Cohen, E.: Structure prediction and computation of sparse matrix products. J. Comb. Optim. 2, 307–332 (1999)

    Article  MathSciNet  MATH  Google Scholar 

  11. Coppersmith, D.: Rectangular matrix multiplication revisited. J. Symb. Comput. 13, 42–49 (1997)

    MathSciNet  MATH  Google Scholar 

  12. Coppersmith, D., Winograd, S.: Matrix multiplication via arithmetic progressions. J. Symb. Comput. 9, 251–280 (1990)

    Article  MathSciNet  MATH  Google Scholar 

  13. 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

    Article  MathSciNet  MATH  Google Scholar 

  14. Galil, Z., Margalit, O.: Witnesses for Boolean matrix multiplication and shortest paths. J. Complex. 417–426 (1993)

  15. 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)

    MATH  Google Scholar 

  16. Golub, G., Van Loan, C. (eds.): Matrix Computations. Johns Hopkins University Press, Baltimore (1989)

    MATH  Google Scholar 

  17. Huang, X., Pan, V.Y.: Fast rectangular matrix multiplications and applications. J. Complex. 14, 257–299 (1998)

    Article  MathSciNet  MATH  Google Scholar 

  18. Joffe, A.: On a set of almost deterministic k-independent random variables. Ann. Probab. 2, 161–162 (1974)

    Article  MathSciNet  MATH  Google Scholar 

  19. 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)

    Google Scholar 

  20. Mehlhorn, K., Galil, Z.: Monotone switching circuits and Boolean matrix product. In: Proc. MFCS 1975, pp. 315–319 (1975)

  21. Munro, J.I.: Efficient determination of the transitive closure of a directed graph. Inf. Process. Lett. 1(2), 56–58 (1971)

    Article  MathSciNet  MATH  Google Scholar 

  22. Paterson, M.: Complexity of monotone networks for Boolean matrix product. Theor. Comput. Sci. 1(1), 13–20 (1975)

    Article  MathSciNet  MATH  Google Scholar 

  23. Pratt, V.R.: The power of negative thinking in multiplying Boolean matrices. SIAM J. Comput. 4(3), 326–330 (1975)

    Article  MathSciNet  MATH  Google Scholar 

  24. Rytter, W.: Fast recognition of pushdown automaton and context-free languages. Inf. Control 67(1–3), 12–22 (1985)

    Article  MathSciNet  MATH  Google Scholar 

  25. Shapira, A., Yuster, R., Zwick, U.: All-pairs bottleneck paths in vertex weighted graphs. In: Proc. SODA 2007, pp. 978–985 (2007)

  26. Seidel, R.: On the all-pairs-shortest-path problem. In: Proc. 24th Annual ACM Symposium on Theory of Computing, pp. 745–749 (1992)

  27. 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)

    Chapter  Google Scholar 

  28. Vassilevska Williams, V., Williams, R.: Subcubic equivalences between path, matrix, and triangle problems. In: Proc. FOCS 2010 (to appear)

  29. Yuster, R., Zwick, U.: Fast sparse matrix multiplication. ACM Trans. Algorithms (TALG) 1(1) (2005). Preliminary version in Proc. ESA (2004)

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Andrzej Lingas.

Additional information

Preliminary version in Proc. ESA 09. Research supported in part by the VR grant 621-2005-4085.

Rights and permissions

Reprints 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

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00453-010-9441-x

Keywords

Navigation