paper

Time-Optimal APSP and Matrix Multiplication in Classes of Linear Neighborhood Complexity

arXiv:2608.25212

Abstract

The notion of linear neighborhood complexity is a very general structural assumption on a graph class, covering most classes of sparse graphs such as planar graphs, graphs excluding a fixed (topological) minor, or bounded expansion graphs, as well as many structured classes of dense graphs, such as graphs of bounded clique-width, twin-width, merge-width, or flip-width. In this work, we present -time optimal algorithms for -vertex graphs coming from a class of linear neighborhood complexity for the following problems: All-Pairs Shortest Paths, the multiplication of the adjacency matrix of the input graph with any matrix. More specifically, after a quadratic preprocessing, we can multiply with any -vector in time. This solves several questions raised in [Bonnet, Kim, Geniet, Moon; ICALP '26], and improves and generalizes results in several other recent papers [Bonnet, Giocanti, Ossona de Mendez, Thomassé; STACS '23], [Bannach, Marwitz, Tantau; STACS '24], [Anand, van den Brand, McCarty; NeurIPS '26], [Kozma, Opler '26], and [Cardinal, McCarty, Yuditsky '26]. We also extend our results to classes of bounded VC density. In classes of linear neighborhood complexity, we also give a triangle-detection algorithm in randomized linear time in -vertex -edge graphs, a -detection algorithm in randomized or deterministic time, and a -detection algorithm in randomized time.

31 pages, 5 figures