0

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?.

dsolimano
  • 8,870
  • 3
  • 48
  • 63
franvergara66
  • 10,524
  • 20
  • 59
  • 101

1 Answers1

5

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.

https://en.wikipedia.org/wiki/Depth-first_search

greut
  • 4,305
  • 1
  • 30
  • 49