def bfs(graph, start):
    """
    Traverses a graph using Breadth First Search Algorithm.
    It returns a set of nodes traversed.
    """
    visited, queue = set(), [start]
    while queue:
        node = queue.pop(0)
        if node not in visited:
            visited.add(node)
            # Add all the adjacent unvisited nodes to the queue
            queue.extend(visited - graph[node])
    return visited
dataset/ETHPy150Open pydsa/pydsa/pydsa/bfs.py/bfs/swapped operands of `-`