I believe that `min(deg.values())` is evaluated for each `n`, and this will end up forcing a quadratic running time. Supposedly, this can be as concise as `v = min(G, key=G.degree)`.