LIST OF EXPERIMENTS
1. Implementation of Uninformed search algorithms (BFS, DFS)
2. Implementation of Informed search algorithms (A*, memory-
bounded A*)
3. Implement naive Bayes models
4. Implement Bayesian Networks
5. Build Regression models
6. Build decision trees and random forests
7. Build SVM models
8. Implement ensembling techniques
9. Implement clustering algorithms
10.Implement EM for Bayesian networks
11.Build simple NN models
12.Build deep learning NN models
,Ex. No. 1.A UNINFORMED SEARCH ALGORITHM - BFS
Date:
Aim:
To write a Python program to implement Breadth First Search (BFS).
Algorithm:
Step 1. Start
Step 2. Put any one of the graph’s vertices at the back of the queue.
Step 3. Take the front item of the queue and add it to the visited list.
Step 4. Create a list of that vertex's adjacent nodes. Add those which are not within the
visited list to the rear of the queue.
Step 5. Continue steps 3 and 4 till the queue is empty.
Step 6. Stop
Program:
graph = {
'5' : ['3','7'],
'3' : ['2', '4'],
'7' : ['8'],
'2' : [],
'4' : ['8'],
'8' : []
}
visited = [] # List for visited nodes.
queue = [] #Initialize a queue
def bfs(visited, graph, node): #function for BFS
visited.append(node)
queue.append(node)
while queue: # Creating loop to visit each node
m = queue.pop(0)
print (m, end = " ")
for neighbour in graph[m]:
if neighbour not in visited:
visited.append(neighbour)
queue.append(neighbour)
# Driver Code
print("Following is the Breadth-First Search")
bfs(visited, graph, '5') # function calling
, Viva questions:
1. What is BFS and how does it differ from other search algorithms such as DFS or A*
search?
2. Can you describe the steps of a BFS algorithm and explain how it works?
3. Can you explain the time and space complexity of a BFS algorithm?
4. Can you give an example of a real-world problem that can be solved using BFS?
5. What does the "visited array" in BFS refer to?
Result:
Thus the Python program to implement Breadth First Search (BFS) was developed
successfully.
1. Implementation of Uninformed search algorithms (BFS, DFS)
2. Implementation of Informed search algorithms (A*, memory-
bounded A*)
3. Implement naive Bayes models
4. Implement Bayesian Networks
5. Build Regression models
6. Build decision trees and random forests
7. Build SVM models
8. Implement ensembling techniques
9. Implement clustering algorithms
10.Implement EM for Bayesian networks
11.Build simple NN models
12.Build deep learning NN models
,Ex. No. 1.A UNINFORMED SEARCH ALGORITHM - BFS
Date:
Aim:
To write a Python program to implement Breadth First Search (BFS).
Algorithm:
Step 1. Start
Step 2. Put any one of the graph’s vertices at the back of the queue.
Step 3. Take the front item of the queue and add it to the visited list.
Step 4. Create a list of that vertex's adjacent nodes. Add those which are not within the
visited list to the rear of the queue.
Step 5. Continue steps 3 and 4 till the queue is empty.
Step 6. Stop
Program:
graph = {
'5' : ['3','7'],
'3' : ['2', '4'],
'7' : ['8'],
'2' : [],
'4' : ['8'],
'8' : []
}
visited = [] # List for visited nodes.
queue = [] #Initialize a queue
def bfs(visited, graph, node): #function for BFS
visited.append(node)
queue.append(node)
while queue: # Creating loop to visit each node
m = queue.pop(0)
print (m, end = " ")
for neighbour in graph[m]:
if neighbour not in visited:
visited.append(neighbour)
queue.append(neighbour)
# Driver Code
print("Following is the Breadth-First Search")
bfs(visited, graph, '5') # function calling
, Viva questions:
1. What is BFS and how does it differ from other search algorithms such as DFS or A*
search?
2. Can you describe the steps of a BFS algorithm and explain how it works?
3. Can you explain the time and space complexity of a BFS algorithm?
4. Can you give an example of a real-world problem that can be solved using BFS?
5. What does the "visited array" in BFS refer to?
Result:
Thus the Python program to implement Breadth First Search (BFS) was developed
successfully.