def entropy_order(linko_enum):
    """Key function to sort by graph shannon entropy.

    Adds another dimention to the linko_enum that is the count of the
    number of links. With this added dimension, this function will
    cause the sort routine to sort first on linograph size, then on
    the number of links, and finally on the backlink encoding using
    that number of links.

    """

    number_of_ones = sum(int(c) for c in bin(linko_enum[1])[2:])

    return linko_enum[0], number_of_ones, linko_enum[1]