def get_edges(mapping):
    """
    Returns the sorted edge list for topology.
    :param mapping: Process-to-node mapping
    :return: Topology edge list
    """
    proc_map = mapping.mapping
    edges = mapping.process_graph.edges(data=True)
    return sorted([(min(proc_map[u], proc_map[v]),
                    max(proc_map[u], proc_map[v]),
                    data['weight']) for u, v, data in edges])