arXiv:2609.08625cs.DMSep 2026

Manuscript Offprint

arXiv:2609.08625

Generalized Graph Search Trees

Florian Krowiorz, Robert Scheffler

Abstract

Graph search algorithms and their corresponding graph search trees are commonly used in algorithmic graph theory. In recent years, the recognition problem of these graph search trees has received significant attention. So far, the research has focused on two types of search trees: first-in trees that behave like BFS-trees and last-in trees that behave like DFS-trees. The search tree paradigms differ from each other by the parent a vertex is connected to. In first-in trees, it is the first visited neighbor, while in last-in trees it is the last neighbor visited before that vertex. Here, we will generalize these concepts of graph search trees by allowing every preceding neighbor of a vertex to be the parent. We study the complexity of the recognition problem of these generalized graph search trees. We present NP-completeness proofs for most searches. We also show that the problem is trivial for Generic Search and polynomial-time solvable for several searches on bipartite graphs and chordal graphs. We also study the question how fixing the start vertex influences the complexity of the problem.

2012 ACM Subject Classification Theory of computation → Graph algorithms analysis; Theory of computation → Problems, reductions and completeness

Keywords and phrases graph search trees, algorithm, computational complexity

1 Introduction

Graph search algorithms are powerful tools that are used in many graph algorithms as subroutines. The best-known examples of these graph searches are Breadth First Search (BFS) and Depth First Search (DFS), which have a wide range of applications. Further graph search algorithms are Lexicographic Breadth First Search (LBFS) [31], Lexicographic Depth First Search (LDFS) [12] as well as Maximum Cardinality Search (MCS) [39]. Although less well known than BFS and DFS, these searches also have several applications. LBFS is a subroutine of recognition algorithms for several graph classes [7, 14, 15], LDFS has been used to solve several optimization problems on cocomparability graphs [9, 10, 23] and MCS can be used to compute minimal triangulations [5].

In recent years, graph search algorithms have also become objects of research besides their application as subroutines. Several researchers considered problems to determine whether the vertex orderings computed by these graph searches can fulfill certain properties. An extensively studied example is the end-vertex problem [1, 8, 13, 17, 21, 27] that asks whether a search ordering can end in a given vertex t∈V(G)t \in V(G) (see [16, Table 6.1] and [33, Table 1] for overviews of known results). Other problems considered the spanning trees produced by those graph searches – also called search trees. In such a tree, every vertex except the start vertex of the search is connected to one of its preceding neighbors. In trees produced by BFS, they are connected to their first visited neighbor, while in DFS trees every vertex is adjacent to the neighbor that was visited last before it. Using a notation introduced by Beisegel et al. [2], we call a BFS-like search tree F\mathcal{F}-tree (short for first-in tree) and a DFS-like search tree L\mathcal{L}-tree (short for last-in tree).

The problem of whether a given spanning tree of a graph is a search tree of a certain search was first considered in the 1980s by Hagerup and Nowak for BFS and DFS [18, 19]. The authors showed that both problems can be solved in linear time. In the following years, similar questions have been considered for weighted graphs and parallel algorithms [20, 25, 26]. In

Generalized Graph Search Trees

the last few years, these questions have gained new attention. As mentioned above, Beisegel et al. [2] introduced F\mathcal{F}-trees and L\mathcal{L}-trees, a general framework for those questions. They were able to prove that the F\mathcal{F}-tree recognition problem of LBFS, LDFS, and MCS are NP-complete while the L\mathcal{L}-tree recognition of LDFS can be solved in polynomial time. In the following years, NP-hardness has also been shown for the F\mathcal{F}-tree recognition of DFS [32], as well as the L\mathcal{L}-tree recognition of BFS [32], LBFS [34], and Generic Search [3] (an overview is given in [33, Table 2]). Generic Search is in some sense the most general graph search since it is allowed to take any vertex as the next one as long as one of its neighbors has already been visited.

Both the F\mathcal{F}-tree recognition problem and the end-vertex problem are special cases of the partial search order problem (PSOP) [35]. Here, a graph and a partial order on its vertex set are given and one is asked whether there is a search ordering that extends the partial order.

Our Contribution Although Beisegel et al. [2] only considered the recognition of F\mathcal{F}-trees and L\mathcal{L}-trees, they also introduced generic search trees of a search ordering as those spanning trees that have an edge from every vertex except the start vertex to exactly one of its preceding neighbors. To avoid confusions with search trees constructed by Generic Search, we will call these trees here generalized search trees (or G\mathcal{G}-trees for short). Similar to the recognition problem of F\mathcal{F}-trees and L\mathcal{L}-trees, we will consider the G\mathcal{G}-tree recognition problem where a graph GG and a spanning tree TT are given and one has to decide whether there exists a search ordering where TT is a G\mathcal{G}-tree of GG. The rooted variant of this problem, where the start vertex of the graph search is fixed, is a special case of the PSOP for partial orders whose Hasse diagram forms a spanning tree of the given graph rooted in a minimal element of the partial order.

We show that the G\mathcal{G}-tree recognition problem is trivial for Generic Search since every spanning tree is a G\mathcal{G}-tree of some Generic Search ordering. Contrary, we show that for (L)BFS, (L)DFS, MCS, and MNS the problem is NP-complete. Furthermore, we study the relationship between the complexity of the rooted and the unrooted problem. While it is easy to see that the unrooted problem can be solved using an algorithm for the rooted problem, the reverse is not true in general. We give a sufficient condition for a graph search and a graph class such that both problems are polynomial-time equivalent. Besides this, we give polynomial-time algorithms for some of the searches for graph classes. We solve the problem for layered searches such as BFS and LBFS on bipartite graphs. Furthermore, we show that a large family of graph searches, called strictly comp-monotone searches, has the same G\mathcal{G}-trees on chordal graphs. As this family includes LBFS, LDFS, MCS and MNS, we can use the polynomial-time algorithms given for the PSOP of MCS on this class [29, 35] to solve the the G\mathcal{G}-tree problem for all these searches. An overview of the results is given in Table 1.

Note that many results of this paper are based on the Bachelor's thesis of the first author [22]. Some of the results given in Section 5.3 are contained in the PhD thesis of the second author [33].

References (25)