Graph Theory37 sections · 1633 units
Open in Course

Problem - Flight Routes Check (CSES 1682)

(CSES 1682 intro)

Problem: you are given a directed graph representing flight routes between cities. Check if you can travel from any city to any other city (following directed edges). If not possible, print two cities aa and bb such that you cannot travel from aa to bb.

The graph is strongly connected if and only if it has exactly one SCC. If there are multiple SCCs, pick two nodes in different components to show impossibility.