For this Question: Given an undirected graph of N nodes and E edges. Edges are given in the form of x y if there is an edge between x and y. Print 1 if graph is connected else print 0.Two integers denoting N and E.
Then E lines follow, in each line two integers u, v denoting there is an edge between them.

Constraints 
1<= N <=100000
0<= M <=100000
1<= u, v <=N
Print 1 if graph is connected else print 0.Input :
4 6
1 2
2 3
3 4
4 2
1 3
2 4

Output:
1, I have written this Solution Code: from collections import defaultdict
N, M = map(int, input().split())
d = defaultdict(list)
for _ in range(M):
	u, v = map(int, input().split())
	d[u].append(v)
vertex = set()
flag = False
for i in d.keys():
	vertex.add(i)
	vertex.update(d[i])
	if(len(vertex) == N):
		flag = True
		break
if(flag):
	print(1)
else:
	print(0), In this Programming Language: Python, Now tell me if this Code is compilable or not?