def _relabel_nodes_integers(g):
    """A helper function that relabels nodes in a graph/network using 
    consecutive integer ids starting from 0. The relabeled ids are 
    ordered following the original alphabetical order as the original 
    node labels.

    Parameters
    ----------
    g : NetworkX Graph or DiGraph
        The original network of which the nodes are to be relabeled.

    Returns
    -------
    NetworkX Graph or DiGraph
        A new network with nodes relabeled.
    rev_mapping : dict
        A mapping from the new node ids (integers) to the original node 
        labels.

    See Also
    --------
    networkx.relabel.relabel_nodes
    """
    mapping = dict()
    rev_mapping = dict()
    for i, node in enumerate(sorted(g.nodes())):
        mapping[node] = i
        rev_mapping[i] = node
    from networkx import relabel_nodes
    return relabel_nodes(g, mapping), rev_mapping
