def enumerate_edges(graph):
    """Return the ordered list of edges of `graph`

    Parameters
    ----------
    graph : input graph
    """
    if hasattr(graph, 'ordered_edges'):
        assert set(graph.edges()) == set(graph.ordered_edges)
        return graph.ordered_edges
    else:
        setattr(graph, 'ordered_edges', sorted(graph.edges()))
        return graph.ordered_edges
