문제

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.

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top