Skip to content

Topological order

networks

Level 2 of 3

Also called Topological sort and Kahn's algorithm.

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 topological order's own run on the numbers shown.

choose one

question 1

On this map, how many roads are crossed off before the queue empties?

A0B2C1E1F1G1A
the answer, and why

the answer is D

A crosses off its 2 roads, which frees E. E has no road out. B still has F to B coming in, so the queue empties.

if you chose another

  • That is every road on the map, but 4 of them sit on a loop.
  • That adds B to C, but B is never taken.
  • That is a ring with no place free, but A has no road coming in.

new numbers

question 2

On which map does the run cross off the most roads? A>B means a road from A to B.

the answer, and why

the answer is A

It has no loop, so each of its 5 roads is crossed off once.

if you chose another

  • Three roads, each crossed off once.
  • Four roads on a ring. No place is free, so it crosses off 0.
  • One road.

new numbers