0% found this document useful (0 votes)
177 views7 pages

Indira Gandhi Delhi Technical University For Women (Igdtuw) : Mechanical and Automation Engineering (MAE) 2019-2023

The document describes three experiments on graph traversal algorithms: 1) Breadth-First Search (BFS) - Traverses the graph by exploring all neighboring nodes at the present depth prior to moving to the next depth level. Advantages include finding shortest paths and not getting trapped in blind alleys. Disadvantages include high memory usage. 2) Depth-First Search (DFS) - Prioritizes exploring depth over breadth, exploring as far as possible along each branch before backtracking. Advantages include lower memory and time complexity than BFS. Disadvantages include possibility of getting trapped in useless paths. 3) Iterative Deepening Search (IDS) - Repeatedly runs DFS with increasing depth limits

Uploaded by

Sheena Khanna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
177 views7 pages

Indira Gandhi Delhi Technical University For Women (Igdtuw) : Mechanical and Automation Engineering (MAE) 2019-2023

The document describes three experiments on graph traversal algorithms: 1) Breadth-First Search (BFS) - Traverses the graph by exploring all neighboring nodes at the present depth prior to moving to the next depth level. Advantages include finding shortest paths and not getting trapped in blind alleys. Disadvantages include high memory usage. 2) Depth-First Search (DFS) - Prioritizes exploring depth over breadth, exploring as far as possible along each branch before backtracking. Advantages include lower memory and time complexity than BFS. Disadvantages include possibility of getting trapped in useless paths. 3) Iterative Deepening Search (IDS) - Repeatedly runs DFS with increasing depth limits

Uploaded by

Sheena Khanna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

INDIRA GANDHI DELHI TECHNICAL

UNIVERSITY FOR WOMEN (IGDTUW)


MECHANICAL AND AUTOMATION ENGINEERING
(MAE)
2019-2023

ARTIFICIAL INTELLIGENCE LAB


MANUAL

5th SEMESTER

SUBMITTED BY: Sheena Khanna


ENROLLMENT NO: 02401042019
EXPERIMENT 1

AIM- Breadth First Search Traversal

THEORY- Breadth-First Search (BFS) is an algorithm used for traversing


graphs or trees. Traversing means visiting each node of the graph. Breadth-
First Search is a recursive algorithm to search all the vertices of a graph or a
tree. BFS in python can be implemented by using data structures like a
dictionary and lists. Breadth-First Search in tree and graph is almost the same.
The only difference is that the graph may contain cycles, so we may traverse
to the same node again.

Advantages of BFS:

• A BFS will find the shortest path between the starting point and any other
reachable node.
• BFS will never get trapped in a blind alley.
• If multiple solutions exist, it finds the one with minimal steps.

Disadvantages Of BFS:

• Takes up a lot of memory space as it stores all the nodes of the present level
to go for the next level.

• It is a ‘blind’ search, when the search space is large performance will be poor.
INPUT-

OUPUT-

RESULT – Implemented BFS on a graph.


EXPERIMENT 2

AIM - Depth First Search Traversal

THEORY – DFS is an algorithm used to traverse or locate a target node in a graph


or tree data structure. It prioritizes depth and searches along one branch as far as it
can go-until the end of that branch. Once there, it backtracks to the first possible
divergence from that branch and searches until the end of that branch, repeating that
process.

Advantages Of DFS:

• The memory requirement is linear with respect to nodes.

• Less time and space complexity rather than BFS.

• Better recovery from failure

The disadvantage of DFS:

• Not Guaranteed that it will give you a solution.

• Cut-off depth is smaller so time complexity is more.

• Might get trapped in searching useless paths.

INPUT-
OUTPUT –

RESULT – Implemented DFS on a graph.


EXPERIMENT 3

AIM - Iterative Depth Search

THEORY- Iterative deepening search or more specifically iterative

deepening depth-first search (IDS or IDDFS) is a state space/graph search

strategy in which a depth-limited version of depth-first search is run

repeatedly with increasing depth limits until the goal is found. At each

iteration, it visits the nodes in the search tree in the same order as depth-first

search, but the cumulative order in which nodes are first visited is effectively

breadth- first.

Advantages of IDDFS
• IDDFS gives us the hope to find the solution if it exists in the tree.
• When the solutions are found at the lower depths say n, then the
algorithm proves to be efficient and in time.
• The great advantage of IDDFS is found in-game tree searching where
the IDDFS search operation tries to improve the depth definition,
heuristics, and scores of searching nodes so as to enable efficiency in the
search algorithm.

Disadvantages of IDDFS
• The time taken is exponential to reach the goal node.
• The main problem with IDDFS is the time and wasted calculations that
take place at each depth.
• The IDDFS might fail when the BFS fails. When we are to find multiple
answers from the IDDFS, it gives back the success nodes and its path once
even if it needs to be found again after multiple iterations. To stop the
depth bound is not increased further.

Input:

Output:

Result – Implemented IDS on a graph.

You might also like