user2555240 user2555240 - 6 days ago 6
C++ Question

Pseudocode for BFS(from The Algorithm Design, 2nd Ed.) confusion?

I need help with BFS pseudocode from The Algorithm Design Manual 2nd Edition, Skiena.

Line that says

process vertex u as desired

and same thing but with edge(s)
process edge (u, v) as desired

How should I write these lines in C++?

Answer

This depends on what you try to achieve with the algorithm. Those locations are the place where you put code which actually does something application specific.

If you're writing just a test-implementation you can insert console outputs there to see in which order the vertices/edges are processed

Comments