def Breadth_First_Traversal(s, adj):
    """
    Takes the starting node for breadth first traversal and the adjoint matrix
    of the graph and returns the level of each node in the graph starting from
    0 for the start node.
    """
    level, parent = {}, {}
    level[s] = 0
    parent[s] = None
    i = 1
    frontier = [s]
    while frontier:
        next = []
        for u in frontier:
            for v in adj[u]:
                if v not in level:
                    level[v] = i
                    parent[v] = u
                    next.append(v)
        frontier = next
        i += 1
    return level