# Baekjoon-2606-바이러스

26 Sep 2022```
from re import L
import sys
input = sys.stdin.readline
N = int(input())
E = int(input())
graph = [[] for _ in range(N+1)]
for _ in range(E):
u,v = map(int, input().split())
graph[u].append(v)
graph[v].append(u)
queue = [1]
visited = [0 for _ in range(N+1)]
visited[1] = 1
count = -1
while queue:
node = queue.pop(0)
count += 1
for child in graph[node]:
if visited[child] == 0:
queue.append(child)
visited[child] = 1
print(count)
```