Transform a graph by applying given functions to the vertices of each
part. Complexity: O((n + m) * log(n)) time.
bimap f g empty == empty
bimap f g . vertex == vertex . Data.Bifunctor.bimap f g
bimap f g (edge x y) == edge (f x) (g y)
bimap idid == id
bimap f1 g1 . bimap f2 g2 == bimap (f1 . f2) (g1 . g2)