How do you perform a breadth-first search in Java?
user
1. Create a Queue.
2. Enqueue the starting node.
3. Mark the starting node as visited.
4. While the Queue is not empty:
    a. Dequeue a node from the Queue.
    b. Process the node.
    c. For each unvisited neighbor of the node, enqueue it and mark it as visited.

Example:
```java
void bfs(Node root) {
    Queue<Node> queue = new LinkedList<>();
    queue.add(root);
    root.visited = true;
    while (!queue.isEmpty()) {
        Node node = queue.remove();
        // Process the node
        for (Node neighbor : node.neighbors) {
            if (!neighbor.visited) {
                queue.add(neighbor);
                neighbor.visited = true;
            }
        }
    }
}
```
assistant