Is the spanning tree found by the algorithm DFS always show in preorder?
-
16-04-2021 - |
سؤال
I'm doing an implementation of the DFS algorithm in c + + to find a spanning tree, the output for a spanning tree using the algorithm DFS is always preorder or is it pure coincidence?.
المحلول
DFS is by definition preorder if you print them as you enter them.
A preordering is a list of the vertices in the order that they were first visited by the depth-first search algorithm.
لا تنتمي إلى StackOverflow