(lst)
Given a list of (app_name, job_id) pairs,
    topological sort by the app_names

    This is useful for sorting the parents and children of a node if the node
    has complex dependencies
Given a list of (app_name, job_id) pairs,
    topological sort by the app_names
Given a list of ( app_name job_id ) pairs topological sort by the app_names
def topological_sort(lst):
    """Given a list of (app_name, job_id) pairs,
    topological sort by the app_names

    This is useful for sorting the parents and children of a node if the node
    has complex dependencies
    """
    dct = defaultdict(list)
    for app_job in lst:
        dct[app_job[0]].append(app_job)
    for node in nx.topological_sort(build_dag()):
        for app_job2 in dct[node]:
            yield app_job2
def topological_sort ( lst ) : dct = defaultdict ( list ) for app_job in lst : dct [ app_job [ 0 ] ] . append ( app_job ) for node in nx . topological_sort ( build_dag ( ) ) : for app_job2 in dct [ node ] : yield app_job2