Skip to content

Breadth-first search

networks

Level 2 of 3

Also called BFS.

fresh numbers

The test's questions that a run answers, asked again on new numbers whenever you like. The answer, its working and the reason for every other choice come from breadth-first search's own run on the numbers shown.

choose one

question 1

The walk starts at E on the map A-E, B-E, C-D, B-C and A-B. How many roads does it look along?

ABCDE0E
the answer, and why

the answer is B

The map is in one piece with 5 roads, and each is looked along from both ends, 10 in all.

if you chose another

  • That counts each road once, but the walk looks along it from both ends.
  • That counts the places found, A, B, C, D, not the roads looked along.
  • That misses one look. D has degree 1, so it looks along its road too.

new numbersthe test page's numbers

question 2

On the town of eight from G, which place leaves the queue fourth?

ABCDEFG0HG
the answer, and why

the answer is C

Places leave the queue in the order they join it: G, B, F, C. So C leaves fourth.

if you chose another

  • F joins third, after G and B, so it leaves third.
  • E joins after C, so it leaves after C.
  • D is 3 roads from G, found only when C leaves.

new numbersthe test page's numbers

question 3

The walk starts at A on each map. Which one makes it look along the most roads?

the answer, and why

the answer is C

From A, B-C, B-F, C-H, A-F, C-D; A makes 10 looks, two for each road in A's piece, the most of the four.

if you chose another

  • That map makes 8 looks, fewer than 10.
  • That map makes 6 looks, fewer than 10.
  • That map makes 8 looks, fewer than 10.

new numbersthe test page's numbers