0% found this document useful (0 votes)
2 views

Module 2 Lecture-1

The document provides an overview of problem-solving through searching in artificial intelligence, emphasizing the definition, criteria for success and failure, and the importance of efficiency in search operations. It discusses various search algorithms and data structures, including linear and non-linear structures like arrays, linked lists, trees, and graphs. Additionally, it explains graph terminology, types of graphs, and their applications in machine learning.

Uploaded by

Balamurali Gunji
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Module 2 Lecture-1

The document provides an overview of problem-solving through searching in artificial intelligence, emphasizing the definition, criteria for success and failure, and the importance of efficiency in search operations. It discusses various search algorithms and data structures, including linear and non-linear structures like arrays, linked lists, trees, and graphs. Additionally, it explains graph terminology, types of graphs, and their applications in machine learning.

Uploaded by

Balamurali Gunji
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

BMEE407 Artificial Intelligence

Module 2
Problem-solving by Searching

01/24/2025 BMEE407L-Module 2 1
01/24/2025 BMEE407L-Module 2 2
01/24/2025 BMEE407L-Module 2 3
Searching

Before we start to learn graph,


we need to know what is Search in AI

01/24/2025 BMEE407L-Module 2 4
Definition
• Searching in computer science and AI involves the systematic
exploration of data to locate a particular element or piece of
information.

The primary goal of searching is to determine whether a specific


target element exists within a given dataset or data structure.

01/24/2025 BMEE407L-Module 2 5
Criteria in Search Operations
Success Criteria:
• A search operation is considered successful if the desired
element is found in the dataset. This implies that the system
has located the requested information.
Failure Criteria:
• Conversely, if the search operation does not locate the target
element, it is considered unsuccessful. In such cases, the
system must appropriately handle and report the absence of
the desired information.

01/24/2025 BMEE407L-Module 2 6
Efficiency

• Efficient searching is crucial, especially when dealing with


large datasets. Algorithmic efficiency, measured by time and
space complexity, becomes a key consideration in choosing an
appropriate search method.

01/24/2025 BMEE407L-Module 2 7
Fundamentals of Search
Search Algorithms
• Various search algorithms are employed in computer science
and AI to efficiently locate elements. Common algorithms
include binary search, linear search, depth-first search, and
breadth-first search.

Data Structures
• The effectiveness of a search often depends on the underlying
data structure. For instance, searching in arrays, linked lists,
trees, graphs, or databases may require different algorithms
and strategies.

01/24/2025 BMEE407L-Module 2 8
What is Data
Structure?
The data structure is defined as the basic building block of
computer programming that helps us to organize, manage
and store data for efficient search and retrieval.
Types of Data Structure

01/24/2025 BMEE407L-Module 2 9
The linear data structure is a special type
Linear Data structure of data structure that helps to organize
and manage data in a specific order where
the elements are attached adjacently.

Array:

Stacks are based on


the concept of LIFO
(Last in First out) or FILO
(First In Last Out). It is
used for binary
classification in deep
learning.

01/24/2025 BMEE407L-Module 2 10
Linked List
A linked list is the type of
collection having several
separately allocated nodes. Or
in other words, a list is the type
of collection of data elements
that consist of a value and
pointer that point to the next
Queu
node in the list
e:

A Queue is defined as the


"FIFO" (first in, first out). It
is useful to predict a
queuing scenario in real-
time programs, such as
people waiting in line to
withdraw cash in the
bank.
01/24/2025 BMEE407L-Module 2 11
Non-linear Data
Structures
Graph

Before we start to learn search


algorithm,
we need to know what is graph

01/24/2025 BMEE407L-Module 2 12
1) Trees
Binary Tree:
The concept of a binary tree is very
much similar to a linked list, but the
only difference of nodes and their
pointers. In a linked list, each node
contains a data value with a pointer
that points to the next node in the
list, whereas; in a binary tree, each
node has two pointers to
subsequent nodes instead of just
one.

01/24/2025 BMEE407L-Module 2 13
Graphs
A graph data structure is also very much useful in machine
learning for link prediction. Graphs are directed or undirected
concepts with nodes and ordered or unordered pairs. Hence, you
must have good exposure to the graph data structure for machine
learning and deep learning.

Directed
Graph

Un Directed
Graph

Weighted
01/24/2025 BMEE407L-Module 2
Graph 14
Maps
Maps are the popular data structure in the programming world, which
are mostly useful for minimizing the run-time algorithms and fast
searching the data. It stores data in the form of (key, value) pair,
where the key must be unique; however, the value can be duplicated.
Each key corresponds to or maps a value; hence it is named a Map.

01/24/2025 BMEE407L-Module 2 15
Heap data
structure
Heap is a hierarchically ordered data structure. Heap data structure is
also very much similar to a tree, but it consists of vertical ordering
instead of horizontal ordering.
Ordering in a heap DS is applied along the hierarchy but not across it,
where the value of the parent node is always more than that of child
nodes either on the left or right side.

01/24/2025 BMEE407L-Module 2 16
What is a graph?
A graph can be defined as group of vertices and edges that are used to
connect these vertices. A graph can be seen as a cyclic tree, where the
vertices (Nodes) maintain any complex relationship among them
instead of having parent child relationship.
Definition
A graph G can be defined as an ordered set G(V, E) where V(G)
represents the set of vertices and E(G) represents the set of edges
which are used to connect these vertices.
A Graph G(V, E) with 5 vertices (A, B, C, D, E) and six edges ((A,B),
(B,C), (C,E), (E,D), (D,B), (D,A)) is shown in the following figure.

01/24/2025 BMEE407L-Module 2 17
Graph Terminology
• Graph: A data structure containing:
– a set of vertices V, (sometimes called nodes)
– a set of edges E, where an edge
represents a connection between 2 vertices.
• Graph G = (V, E)
• The graph at right:
– V = {a, b, c, d} a b
– E = {(a, c), (b, c), (b, d), (c, d)}

• Degree: number of edges touching a given vertex. c d


– at right: a=1, b=2, c=3, d=2

01/24/2025 BMEE407L-Module 2 18
Graph examples
• For each, what are the vertices and what are the edges?
– Web pages with links
– Methods in a program that call each other
– Road maps (e.g., Google maps)
– Airline routes
– Facebook friends
– Course pre-requisites
– Family trees
– Paths through a maze

01/24/2025 BMEE407L-Module 2 19
Paths
• Path: A path from vertex a to b is a sequence of edges
that can be followed starting from a to reach b.
– can be represented as vertices visited, or edges taken
– example, one path from V to Z: {b, h} or {V, X, Z}
– What are two paths from U to Y?
V
• Path length: Number of vertices a b
or edges contained in the path. U
d
X Z
h
c e
• Neighbor or adjacent: Two vertices W g
connected directly by an edge.
f
– example: V and X Y

01/24/2025 BMEE407L-Module 2 20
Reachability, connectedness
• Reachable: Vertex a is reachable from b V
a b
if a path exists from a to b.
d
U X Z
h
• Connected: A graph is connected if every c e
vertex is reachable from any other. W g
– Is the graph at top right connected? f
Y
• Strongly connected: When every vertex
has an edge to every other vertex.
a b
a b d
c
c d e

01/24/2025 BMEE407L-Module 2 21
Loops and cycles
• Cycle: A path that begins and ends at the same
node.
– example: {b, g, f, c, a} or {V, X, Y, W, U, V}.
– example: {c, d, a} or {U, W, V, U}.
– acyclic graph: One that does V
a b
not contain any cycles. d
U X Z
h
c e
• Loop: An edge directly from W g

a node to itself. f
Y
– Many graphs don't allow loops.
01/24/2025 BMEE407L-Module 2 22
Directed graphs
• Directed graph ("digraph"): One where edges are
one-way connections between vertices.
– If graph is directed, a vertex has a separate in/out
degree.
– A digraph can be weighted or unweighted.
– Is the graph below connected? Why or why not?
a b

c d e

f g

01/24/2025 BMEE407L-Module 2 23
Directed Acyclic Graph
• DAG is a type of graph structure
• It consists of vertex/nodes connected by edges
• Each edge has a direction
• There are no cycles

Let's break down the key components: directed graph and


Acyclic

01/24/2025 BMEE407L-Module 2 24
THANK YOU

01/24/2025 BMEE407L-Module 2 25

You might also like