If not, the shallow depth first search tree can be used to construct a tree decomposition with bounded width, and standard dynamic programming techniques for graphs of bounded treewidth can be used to compute the depth in linear time.
12.
More specifically, the dependence on " n " in this algorithm can be made linear, by the following method : compute a depth first search tree, and test whether this tree's depth is greater than 2 " d ".
13.
In any graph, directed or undirected, there is a straightforward algorithm for finding a widest path once the weight of its minimum-weight edge is known : simply delete all smaller edges and search for any path among the remaining edges using breadth first search or depth first search.