Lyft interview question

Was not expecting graph theory question