There is an easy way to partition the set of - paths in a graph . Fix an edge in . Let be the set of paths from to which use the edge , and let be the set of paths from to in . Then and the set of - paths . Moreover, there is a one to one correspondence between the set of paths and the set of - paths in the graph .
Thus, we get an easy recursive algorithm to find the set of paths - paths in a graph . Pick an edge incident the vertex and recursively calculate the sets and . With a small amount of pre-processing, we can ensure that the runtime is where is the number of edges and is the number of - paths.
To make the recurrence relation on the runtime work, consider the following. We can test in time if a given graph and pair of vertices and if has 0, exactly one, or at least two distinct - paths. To see this, simply find the block decomposition of the graph and, and check if there is any non-trivial block between and in the tree.
We can push this slightly farther. Given an instance of the problem and vertices and , we can reduce the problem in time to a graph and vertices and such that for all edges incident to , we have that
- is in some - path,
- there exists a - path in .
To see this, again using the block decomposition, we contract any bridge in the graph and delete edges not contained in any - path. As above, this can be done in time.
We give an time algorithm to find the set of - paths in a given graph with at least two - paths.
- We may assume, as above, that every edge incident to is contained in some - path and that there exists at least one - path in .
- Check if the number of - paths in is at least two, and if not, let be the set of the unique - path in . If there are at least two such paths, we recursively find the set of all such paths. Let . By choice of , .
- Check if the number of - paths in is at least two, and if not let be the set of the unique - path in . Otherwise, we recursively find the set of - path in . Let , and as above, we again have .
Step 1 can be performed in operations for some constant . The initial check in steps and can be performed in steps. If we must recursively run the algorithm, this will require another operations for in Steps 2 and 3, respectively. As , we can bound the work in each of Steps 2 and 3 by . Thus, the total number of operations is at most if we choose .
No comments:
Post a Comment