def edges(G):
    """Returns the edge set of G as pairs (v, w)"""
    for v, adj in G.iteritems():
        for w in adj:
            yield v, w
Returns the edge set of G as pairs (v, w)
recipes/Python/498260_Examples_algorithm_compositiobserver_pattern/recipe-498260.py