def label_emergence(g):
    """label_emergence
    Creates a property map that identifies whether a vertex is categorised as
    ephemeral, emerging, steady, or declining.

    The categories are represented as integers with the following mapping:
        {0: 'ephemeral',
         1: 'emerging',
         2: 'steady',
         3: 'declining'}
         
    Parameters
    ----------
        g : :obj:`Graph`
            A graph.

    Returns
    -------
        emergence : :obj:`graph_tool.VertexPropertyMap` 
            An integer property map that represents the emergence category of 
            each vertex.
    """
    emergence = g.new_vertex_property('int')
    for v in g.vertices():
        if (v.in_degree() == 0) & (v.out_degree() == 0):
            # ephemeral
            emergence[v] = 0
        elif (v.out_degree() == 0) & (v.in_degree() > 0):
            # emerging
            emergence[v] = 1
        elif (v.out_degree() > 0) & (v.in_degree() == 0):
            # declining
            emergence[v] = 3
        else:
            # steady
            emergence[v] = 2
    return emergence