  Algorithmicists are well-aware that fast dynamic programming algorithms are
very often the correct choice when computing on compositional (or even
recursive) graphs. Here we initiate the study of how to generalize this
folklore intuition to mathematical structures writ large. We achieve this
horizontal generality by adopting a categorial perspective which allows us to
show that: (1) structured decompositions (a recent, abstract generalization of
many graph decompositions) define Grothendieck topologies on categories of data
(adhesive categories) and that (2) any computational problem which can be
represented as a sheaf with respect to these topologies can be decided in
linear time on classes of inputs which admit decompositions of bounded width
and whose decomposition shapes have bounded feedback vertex number. This
immediately leads to algorithms on objects of any C-set category; these include
-- to name but a few examples -- structures such as: symmetric graphs, directed
graphs, directed multigraphs, hypergraphs, directed hypergraphs, databases,
simplicial complexes, circular port graphs and half-edge graphs.
  Thus we initiate the bridging of tools from sheaf theory, structural graph
theory and parameterized complexity theory; we believe this to be a very
fruitful approach for a general, algebraic theory of dynamic programming
algorithms. Finally we pair our theoretical results with concrete
implementations of our main algorithmic contribution in the AlgebraicJulia
ecosystem.
