def reverse(G):
    """Reverses the edges in a graph.

    Always returns an adjacency list representation, using the GvR
    model. Empty vertices are maintained.
    """

    R = {}
    for v in vertices(G): R[v] = []
    for v, w in edges(G): R[w].append(v)
    return R
Reverses the edges in a graph.

    Always returns an adjacency list representation, using the GvR
    model. Empty vertices are maintained.
    
recipes/Python/498260_Examples_algorithm_compositiobserver_pattern/recipe-498260.py