  We investigate the locality number, a recently introduced structural
parameter for strings (with applications in pattern matching with variables),
and its connection to two important graph-parameters, cutwidth and pathwidth.
These connections allow us to show that computing the locality number is
NP-hard, but fixed-parameter tractable, if parameterised by the locality number
or by the alphabet size, which has been formulated as open problems in the
literature. Moreover, the locality number can be approximated with ratio
O(sqrt(log(opt)) log(n)). An important aspect of our work -- that is relevant
in its own right and of independent interest -- is that we identify connections
between the string parameter of the locality number on the one hand, and the
famous graph parameters of cutwidth and pathwidth, on the other hand. These two
parameters have been jointly investigated in the literature and are arguably
among the most central graph parameters that are based on "linearisations" of
graphs. In this way, we also identify a direct approximation preserving
reduction from cutwidth to pathwidth, which shows that any polynomial
f(opt,|V|)-approximation algorithm for pathwidth yields a polynomial 2f(2
opt,h)-approximation algorithm for cutwidth on multigraphs (where h is the
number of edges). In particular, this translates known approximation ratios for
pathwidth into new approximation ratios for cutwidth, namely O(sqrt(log(opt))
log(h)) and O(sqrt(log(opt)) opt) for (multi) graphs with h edges.
