Graph algorithm simplified, performance improved.
Benchmark: two-levels deep adaptation.