The BFS algorithm uses:
- open[x] to store whether vertex x has been added to the
queue
- d[x] to store the distance of x from S
- pred[x] to refer to the predecessor of x in the
breadth-first tree
Note that the following pseudo-code uses indenting to indicate block
structure. That is, consecutive statements at the same indentation level are
all to be executed in the same block.