Google interview question

Go through the graph using typescript.