Professional Documents
Culture Documents
Week 11
Week 11
WEEK – 11
PROGRAM:
graph = {}
OUTPUT:
n = int(input("Enter number of Nodes:
")) for i in range(n):
Enter number of Nodes: 7
Enterkey
the= parent
input("Enter
Node: 5the parent Node: ")
Entervalue = list(map(str,input("Enter
the child Nodes3 7 the child
EnterNodes").split()))
the parent Node: graph[key]
3 = value
Enter the child Nodes2 4
Enter the= parent Node: 7
visited
Enter the child Nodes8
[] queue =
Enter the parent Node: 2
[]
Enter the child Nodes
while queue
m = queue.pop(0)
print (m, end = "
")