def topsort(edge_dict, root=None):
    """
	List of nodes in topological sort order from edge dict
	where key = rv and value = list of rv's children
	"""
    queue = []
    if root is not None:
        queue = [root]
    else:
        for rv in edge_dict.keys():
            prior = True
            for p in edge_dict.keys():
                if rv in edge_dict[p]:
                    prior = False
            if prior == True:
                queue.append(rv)
    visited = []
    while queue:
        vertex = queue.pop(0)
        if vertex not in visited:
            visited.append(vertex)
            for nbr in edge_dict[vertex]:
                queue.append(nbr)
    return visited
