Can anyone explain why solution1 is better than solution2 although solution1 has the run time of O(EV) and solution 2 has the runtime of O(E log(v)).