def topological_sort(self, start, visited, sort):
    'Perform topological sort on a directed acyclic graph.'
    current = start
    visited.append(current)
    neighbors = edges[current]
    for neighbor in neighbors:
        if (neighbor not in visited):
            sort = topological_sort(neighbor, visited, sort)
    sort.append(current)
    if (len(visited) != len(vertices)):
        for vertice in vertices:
            if (vertice not in visited):
                sort = topological_sort(vertice, visited, sort)
    return sort
Perform topological sort on a directed acyclic graph.
def topological_sort(self, start, visited, sort):
    
    current = start
    visited.append(current)
    neighbors = edges[current]
    for neighbor in neighbors:
        if (neighbor not in visited):
            sort = topological_sort(neighbor, visited, sort)
    sort.append(current)
    if (len(visited) != len(vertices)):
        for vertice in vertices:
            if (vertice not in visited):
                sort = topological_sort(vertice, visited, sort)
    return sort