Editor

Graph problems in Python

Paths, cycles and components in networks of nodes and edges, as Python problems with tests.

Beginner

  1. 37. Most FriendsWho has the biggest circle of friends?35 XP6 min
  2. 45. Mutual FollowsWho follows each other back?40 XP8 min
  3. 255. The Party CelebrityIs there a famous face at this party?40 XP7 min

Intermediate

  1. 61. One-Way StreetsCan you drive to your destination without going the wrong way?60 XP10 min
  2. 79. Count the IslandsHow many separate islands are on this map?70 XP12 min
  3. 81. Friend GroupsHow many separate circles of friends are there?70 XP12 min
  4. 105. Escape the MazeWhat is the quickest way out of the maze?85 XP15 min
  5. 271. Keys in Locked RoomsKeys hide inside locked rooms: how far can you get?60 XP10 min
  6. 337. Fewest Stops on the MetroThe metro trip with the fewest stops85 XP18 min

Advanced

  1. 118. WildfireHow long until the whole forest has burned?110 XP18 min
  2. 124. Split Into Two TeamsCan rivals always end up on opposite teams?115 XP20 min
  3. 146. Course OrderIn what order can you take every course?135 XP25 min
  4. 159. Cheapest Cable NetworkConnect every house for the least money145 XP25 min
  5. 161. Signal DelayHow long until a message reaches every computer?150 XP25 min
  6. 353. Open the LockSpin the wheels of a lock without hitting a jam120 XP20 min
  7. 369. Most Reliable RouteWhich route gives a fragile message its best chance?130 XP25 min
  8. 377. One Cable Too ManyOne extra cable turned a tidy network into a loop135 XP25 min
  9. 381. Back Before You LeftCan you arrive home before you set off?140 XP25 min
  10. 396. The Quietest TownWhich town has the fewest neighbours within a short drive?140 XP25 min
  11. 404. Chains of ConversionsMiles to inches, cups to gallons: follow the chain150 XP30 min
  12. 418. Alien AlphabetWork out a strange alphabet from a page of its dictionary160 XP35 min

Expert

  1. 179. Word LadderTurn one word into another, one letter at a time210 XP35 min
  2. 186. Cheapest Trip with Few StopsThe best fare when you can only change planes so many times235 XP40 min
  3. 433. Fewest BusesGet across town changing buses as few times as possible200 XP35 min
  4. 453. Critical CablesWhich single cable would split the network if it broke?230 XP45 min
  5. 461. Strongly Connected GroupsGroups of web pages that can all reach each other230 XP45 min
  6. 463. Best Exchange RateSwap money through a chain of currencies, unless the chain prints money240 XP45 min
  7. 473. The Night RoundThe shortest round that checks every room of a building240 XP45 min
  8. 481. Use Every TicketA pile of plane tickets and one trip that uses them all250 XP50 min
  9. 492. Pipe Network FlowHow much water can the pipes carry to the city?270 XP55 min

Other topics

Or see every challenge, with study plans, today's challenge and duels.