Source: https://www.cse.cuhk.edu.hk/~taoyf/course/comp3506/lec/scc.pdf