Graph Explorer — Algorithms

Treasure map: 10 levels predicting graph algorithm output: adjacency lists, BFS, DFS, Dijkstra, Bellman-Ford, topological sort, Kruskal MST, bipartite checks.

What the levels ask

  1. Bagas copies the base’s route board as an adjacency list: each place gets one card for each place one road away. Every road on this map is two-way. How many cards does Bagas write in all?
  2. The neighbourhood head leaves a notice about the village work day. Bagas’s rule (BFS): the queue starts at the base, A; Mr. Harun rides to the house at the front, then its neighbours not yet listed join the back of the queue, in letter order. Roads are two-way. Tap the houses in the order he reaches them, starting from A.
  3. Mr. Harun’s fare is counted by the road, along the way with the fewest roads from the base, A. Bagas writes the number of roads on each house’s fare board. Fill in boards A to E (A itself is 0). Roads are two-way.
  4. Mrs. Yanti sends lunch tins down the back lanes. Bagas’s rule (DFS): from each house, take the lane to an unvisited house with the smallest letter; at a dead end, go back to the house before. Roads are two-way. Tap the houses in the order Mr. Harun reaches them, starting from A.
  5. The plan for Thursday night’s feast: an arrow is goods sent from one house to another, and each house only sends once all the goods for it have arrived. If the goods go round in a loop, everyone waits on everyone. Is there a loop or not?
  6. The neighbourhood head lends the hall’s steamer first thing in the morning, so nobody waits on anybody now. Kahn’s way: a house with no arrows left coming in is ready to be picked up; Mr. Harun picks up the ready house with the smallest letter, then the arrows from that house are crossed off. Tap the houses in pick-up order.
  7. A customer asks how many minutes the motorbike taxi takes. Mr. Harun knows the minutes of every road, potholes and all. Dijkstra: from the base, A, lock the house with the smallest tentative minutes, then update its neighbours when a road makes them faster. Roads are two-way. Fill in the fastest minutes for A to D.
  8. The net cost of each trip from the base, A, in thousands of rupiah: fuel minus what the goods pay. B to C carries Mrs. Lastri’s iced fish for Mrs. Ijah: it pays more than the fuel, so its cost is minus. The arrows are one-way. Fill in the cheapest cost for A to D with Bellman-Ford.
  9. Sunday morning work day. The hall’s cement only goes so far: every house joined by concrete with the fewest sacks. Kruskal: cheapest road first, skip a road whose two ends are joined by concrete already. Tap the roads to pave.
  10. After the paving, the neighbourhood head makes a parking rule: each house parks its motorbike in the lane on odd or on even dates, and two houses on one lane must have different days so the motorbike taxi can always get through. Can every house get a day?