MissionWired interview question

Had to complete a graph exercise