arXiv:2610.17887cs.DBOct 2026

Manuscript Offprint

arXiv:2610.17887

Path Length Existence Problems in Bounded-Treewidth Probabilistic Graphs

Antoine Amarilli, Mikaël Monet, Harshul Sagar

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

We consider the problem of testing the existence of a source-to-target path satisfying an input-specified length constraint in an input probabilistic graph, as a simplified model of query evaluation on a probabilistic database. More precisely, we wish to determine the probability that a suitable walk or simple path exists, and consider the cases of a length constraint requiring the length to be at least ℓ\ell, at most ℓ\ell, or exactly ℓ\ell, for ℓ\ell a target length given as input and written in binary. The probabilistic graphs that we consider are directed graphs where each edge is annotated with an independent probability of existence. Our goal is to determine, given such a graph, endpoints, and length constraint, what is the probability that a requisite path/walk exists, i.e., the total probability of the outcomes that satisfy this requirement. As this task is generally intractable (#P-hard), we aim for algorithms applying to input graphs that are assumed to be of bounded treewidth.

We show that, in contrast to many other tasks on probabilistic graphs (e.g., computing the probability of MSO formulas), bounding the treewidth does not always imply tractability of our problems, and we characterise the resulting complexity landscape. Specifically:

We give an XP algorithm parameterised by treewidth to compute the probability that an input probabilistic graph contains a source-to-target path/walk of length ≥ℓ\geq \ell, and do the same for a path/walk of length ≤ℓ\leq \ell. This implies in particular that these problems are in PTIME on graphs whose treewidth is bounded by a constant.

We show that XP is likely the best one can hope for the four problems mentioned in the last item, as we show that these are W[1]-hard (under Turing reductions) parameterised by pathwidth (hence not FPT under the standard assumption that FPT≠W[1]). This is in contrast to the case of non-probabilistic graphs, where the corresponding problems were known to be FPT parameterised by treewidth; and to the connectivity problem (and more generally MSO evaluation) on probabilistic graphs, where the same was known.

Surprisingly, we show that it is #P-hard to compute the probability that an input graph contains a source-to-target path/walk of length exactly ℓ\ell, even on graphs of pathwidth 2. By contrast, all our problems are tractable on graphs of treewidth 1.

Last, we investigate the complexity of our problems when the edges can carry weights. This causes all our problems to become #P-hard already on pathwidth-2 graphs, and causes specifically the “exactly ℓ\ell” walk problem to be #P-hard even on pathwidth-1 graphs.

2012 ACM Subject Classification Theory of computation → Design and analysis of algorithms

Keywords and phrases probabilistic graphs, tree decompositions, walks, simple paths

Usage of AI We used the free version of LLMs for two purposes. First, to find related work we might have missed and for minor uses (proofreading, LaTeX help, TikZ, etc.). Second, the proof of the W[1]-hardness result (Theorem 5.2) was found with LLM assistance.

Path Length Existence Problems in Bounded-Treewidth Probabilistic Graphs

1 Introduction

Probabilistic graphs have been studied in computer science both as a theoretical object of study and as an applicative model [32], e.g., describing possible failures in a computer network, closures on road networks, uncertain connections in social networks, etc. We consider the simplest such model: every edge is annotated with a probability, and the edge is then present with this probability, independently from all other edges. Such graphs are an arity-two case of tuple-independent probabilistic databases [34], which have also been studied in their own right [7, 29, 4].

We study the question of efficiently finding paths in such graphs, which is related to the two-terminal network reliability problem in probabilistic graphs (ST-CON). This problem asks, given a probabilistic graph G, a source s, and a target t, what is the probability that there is some path from s to t, i.e., what is the total probability of the graphs having such a path in the distribution represented by the graph G. We can of course always solve this problem exactly by considering every possible realisation of G, solving the (non-probabilistic) st-reachability problem, and summing the probabilities of the realisations where a path exists. However, in general the number of realisations is exponential in the size of G, so this algorithm is inefficient. It has in fact been shown [35, Theorem 1] that ST-CON is #P-complete, so it is unlikely that substantially better algorithms exist.

However, the tractability of ST-CON is regained when the probabilistic graph is assumed to have bounded treewidth [9, 37, 25], i.e., to be similar to a tree. More precisely, for any treewidth bound k∈Nk \in \mathbb{N}, the ST-CON problem can be solved in polynomial time when the input probabilistic graphs are restricted to have treewidth at most kk; in fact the problem is fixed-parameter tractable (FPT) when parameterised by treewidth. This observation generalises to the fixed-parameter tractability of the class of monadic second-order queries (MSO) on tuple-independent probabilistic databases parameterized by treewidth, namely, the problem is in linear time in the database up to the cost of arithmetic operations [2, 3]. While the motivation of treewidth is theoretical, its amenability to dynamic programming techniques makes it potentially attractive for practical applications, and the experimental treewidth of practical data has for instance been investigated in earlier work [30].

However, these results do not address the task of finding paths of specified lengths in probabilistic graphs, a query which is not generally expressible in MSO. For instance, we can ask for the probability that the shortest path from s to t has length less than some threshold, e.g., to check if t can be reached from s in a road network with edge probabilities subject to a time budget. Such questions have been investigated [32, 38], in particular in connection to the computation of most probable shortest paths that form a kind of generalisation of shortest paths in probabilistic graphs. However, while these tasks are generally intractable on unrestricted probabilistic graphs, to our knowledge it had not been investigated whether tractability could also be regained in this setting by bounding the treewidth, ideally with an FPT algorithm. The one exception we are aware of is the very recent preprint of Ando [8], which gives a #P-hardness proof and an XP algorithm parameterised by treewidth to compute the distribution of the longest and shortest simple paths in a probabilistic graph. However their setting is different because they consider edge lengths that are probabilistic (according to a continuous distribution), whereas we consider graphs with edges annotated by a probability of existence. It turns out however that some aspects of the #P-hardness proof of [8] are related to the W[1]-hardness proof that we present later.

Contributions. In this paper, we consider the question of computing paths satisfying length constraints in probabilistic graphs. More precisely, we consider three types of length requirements: asking for paths of length ⩽ℓ\leqslant \ell, or =ℓ=\ell, or ⩾ℓ\geqslant \ell, for an integer threshold ℓ\ell given as input (and written in binary). We consider the search for simple paths, and the search for walks (which may revisit a given vertex): while this choice makes no difference for shortest paths (or paths of length ⩽ℓ\leqslant \ell), it may make a difference in general because revisiting vertices may be useful to achieve higher lengths. This gives six problem combinations: PLEP⩽PathPLEP_{\leqslant}^{Path}, PLEP=PathPLEP_{=}^{Path}, and PLEP⩾PathPLEP_{\geqslant}^{Path} for paths; and PLEP⩽WalkPLEP_{\leqslant}^{Walk}, PLEP=WalkPLEP_{=}^{Walk}, and PLEP⩾WalkPLEP_{\geqslant}^{Walk} for walks.

For each of these six problems, the input consists of a probabilistic graph G, a source vertex s and target vertex tt, and the threshold ℓ\ell. Our task is to compute the total probability of the realisations of G\mathcal{G} where a suitable path from ss to tt exists. Our goal is to study the complexity of these problems when the input graph G\mathcal{G} has bounded treewidth.

To our surprise, the complexity landscape turns out to be more complicated than expected. We initially expected these problems to behave like ST-CON, and to be fixed-parameter tractable on bounded-treewidth data by being captured by a suitable logic (e.g., an extension of monadic second-order logic, in the spirit of quantitative MSO [28, 27] or other extensions [27]). However, it turns out that tractability does not always hold, that they generally do not enjoy FPT algorithms (conditionally), and that in particular the six problems do not have the same complexity. We now present the results that we obtain, and the structure of the paper.

After formally defining our problems in Section 2, we first review the complexity of the six problems on non-probabilistic graphs in Section 3. Indeed, the problems PLEP≥PathPLEP_{\geq}^{Path} and PLEP≥PathPLEP_{\geq}^{Path}, which ask for long simple paths, are NP-hard already on non-probabilistic graphs because of an immediate reduction from the Hamiltonian path problem. So we introduce treewidth as a way to regain tractability, and show that all six variants of our problems are FPT when parameterised by treewidth. This result is not surprising and follows known constructions, e.g., for the Hamiltonian path problem on bounded-treewidth graphs [39], for which efficient FPT algorithms are known [17, 19, 20] achieving cO(k)nO(1)c^{\mathcal{O}(k)}n^{\mathcal{O}(1)} for some constant c and with k the input treewidth. We will sketch in the section a self-contained proof of these results, introducing notions that will be lifted later to study PLEP≥PathPLEP_{\geq}^{Path} on bounded-treewidth probabilistic graphs. The situation for non-probabilistic graphs is summarised in Table 1a.

We then move to probabilistic graphs in Section 4. Like ST-CON, all six problems become #P-hard when the input probabilistic graphs are arbitrary; so we study the impact of bounding the treewidth. We show that, for treewidth-1 graphs (i.e., probabilistic forests), the six problems indeed become tractable, by an ad-hoc dynamic programming argument.

The key technical results of the paper are given in Section 5, where we investigate whether tractability extends to arbitrary treewidth bounds. We show tractability on bounded-treewidth probabilistic graphs of four of our six problems: PLEP≤PathPLEP_{\leq}^{Path}, PLEP≤WalkPLEP_{\leq}^{Walk}, PLEP≥WalkPLEP_{\geq}^{Walk}, and PLEP≥PathPLEP_{\geq}^{Path}. Namely, we show that these algorithms are XP parameterised by treewidth, and that they are likely not FPT because they are W[1]-hard already on acyclic graphs and when parameterising by pathwidth. Note that this contrasts both with the FPT results for these problems on non-probabilistic graphs, and with the FPT results for ST-CON on probabilistic graphs. Our XP algorithms are shown by standard dynamic programming arguments but with significant complications to account for the probabilistic computations: we first cover the problems PLEP≤PathPLEP_{\leq}^{Path} and PLEP≤WalkPLEP_{\leq}^{Walk}, then the problem PLEP≥WalkPLEP_{\geq}^{Walk} which adds the computation of handling “arbitrarily high” walk lengths, then the problem PLEP≥PathPLEP_{\geq}^{Path} which asks for long simple paths. This latter problem is the most complicated one to cover, as we must both perform probability computations and ensure that the witnessing paths are simple, generalising the technique used on non-probabilistic graphs. In all these results, we use the “monotonicity” of the ≤ℓ\leq \ell and ≥ℓ\geq \ell requirements: they intuitively make it possible to concisely summarise realisations in a bottom-up dynamic programming algorithm on the tree decomposition, by considering the best possible choices of paths that can be achieved below each bag and using this as a way to group realisations together. The W[1]-hardness proof is by a reduction from the problem of counting the number of linear extensions of a partially ordered set, like in [8].

The natural question is whether we can similarly design tractable algorithms for PLEP≥PathPLEP_{\geq}^{Path} and PLEP≥WalkPLEP_{\geq}^{Walk} on bounded-treewidth probabilistic graphs. Surprisingly, we show in Section 6 that the answer is negative (under standard complexity assumptions). Namely, we show that the two problems PLEP≥PathPLEP_{\geq}^{Path} and PLEP≥WalkPLEP_{\geq}^{Walk} are #P\#P-hard already on pathwidth-2 probabilistic graphs. Note that, because we are talking about the probability of existence of paths of a certain length, the probability of existence of a path of length exactly ℓ\ell cannot be obtained simply by subtracting, e.g., the probability of existence of paths of length ≤ℓ−1\leq \ell - 1 from the probability of existence of paths of length ≤ℓ\leq \ell (as the corresponding outcomes are not mutually exclusive). The situation is summarised in Table 1b.

We then study in Section 7 the variants of our problems on weighted graphs, i.e., the edges of the

Path Length Existence Problems in Bounded-Treewidth Probabilistic Graphs

↓X⋈\downarrow X\bowtie⩽ℓ\leqslant \ell=ℓ= \ell⩾ℓ\geqslant \ell
WalkPTIMEPTIMEPTIME
PathPTIMENP-c.FPTNP-c.FPT

(a) On non-probabilistic graphs

↓X⋈\downarrow X\bowtie⩽ℓ\leqslant \ell=ℓ= \ell⩾ℓ\geqslant \ell
Walk#P-h.XP (tw)W[1]-h. (pw)#P-h. (pw 2)FP (tw 1)#P-h.XPW[1]-h.
Path#P-h.XP (tw)W[1]-h. (pw)#P-h. (pw 2)FP (tw 1)#P-h.XP (tw)W[1]-h. (pw)

(b) On probabilistic graphs

Table 1 Summary of the complexity of the problems PLEP⋈X_{\bowtie}^{X}

graph carry weights (written in binary) in addition to their probabilities, and the length requirements now pertain to the total weights of paths. The use of weights can be relevant, e.g., to model lengths or durations in routing applications. We show that adding weights can have a significant impact on the complexity of our problems: it makes PLEP=_{=}Walk and PLEP=_{=}Path NP-hard already on pathwidth-2 non-probabilistic graphs, and in the presence of both probabilities and weights all our problem variants become #P-hard on pathwidth-2 graphs. We also show #P-hardness on pathwidth-1 graphs for PLEP=_{=}Walk specifically when we have weights and probabilities, remembering that the problem PLEP=_{=}Walk was tractable on treewidth-1 unweighted probabilistic graphs.

We conclude in Section 8. Most detailed proofs are deferred to the appendix.