Search Algorithms in Artificial Intelligence

Author: Ram Tavva, Eminent Data Scientist


The replication of human insight through computer frameworks or machines is what we fundamentally mean by Artificial Intelligence. It is done through the interaction of securing information or data and the expansion of decisions that are utilized by data. For example learning, and afterward utilizing these guidelines to draw conclusions and then self-remedy. With the assistance of AI, we can easily make such programming or gadgets which can tackle genuine issues effectively and with precision, for example, medical problems, advertising, traffic issues, and so forth. It also helps us to make our own menial helper, like Siri, Google Assistant, and Cortana. We can a;so assemble such Robots which can work in a climate where the endurance of people can be in danger. Computer based intelligence opens a way for other new advances, new gadgets, and new Opportunities.

Intelligence and Smartness are the strength of the human species; we have utilized it to improve our lives. Then, at that point, we made the idea of computerized reasoning, to intensify human knowledge and to create and thrive civilizations more than ever. The various Search Algorithms have been created to help us. In this blog, we will get familiar with the properties and types of Searching Algorithms. In the later section, we shall dive more deeper to understand it better.

Search Algorithms in Artificial Intelligence

Properties of Search Algorithms:

Fulfillment: A hunt calculation is finished when it’s anything but an answer for any info if at any rate one arrangement exists for that specific information. 

Optimality: If the arrangement found by the calculation is the best arrangement, for example it has the most reduced cost, then, at that point that arrangement is considered as the ideal arrangement. 

Reality Complexity: Time intricacy is the time taken by a calculation to finish its job, and space intricacy is the greatest extra room required during the inquiry activity.

Search Algorithm Terminologies: 

  1. Search: Searching is a bit by bit method to tackle an inquiry issue in a given pursuit space. A pursuit issue can have three principle factors: 
  • Search Space: Search space addresses a bunch of potential arrangements, which a framework may have. 
  • Objective test: It is a capacity which notices the present status and returns if the objective state is accomplished. 
  • Start State: It is a state from which a specialist starts the pursuit. 
  1. Search tree: A tree portrayal of a search issue is called Search tree. The base of the pursuit tree is the root hub which is related to the underlying state. 
  2. Activities: It gives the portrayal of the multitude of accessible activities to the specialist.
  3. Progress model: A depiction of what each activity does, can be addressed as a change model. 
  4. Way Cost: It is a capacity which doles out a numeric expense for every way. 
  5. Arrangement: It is an activity succession which leads from the beginning hub to the objective hub. 
  6. Ideal Solution: If an answer has the most reduced expense among all arrangements.

Kinds of Search Algorithms 

There are two kinds of search algorithms in Artificial Intelligence, Uninformed and Informed which are clarified beneath: 

Search Algorithms in Artificial Intelligence

1. Uninformed Search Algorithms: Uninformed search algorithms don’t have any space or domain information. Its working principle depends on brute force manner and hence, sometimes also called brute force algorithm.. It has no information about how far the objective hub or node is, it just realizes how to cross and recognize a leaf hub and objective hub. It inspects each hub with no earlier information consequently likewise called blind search algorithms 

Uninformed search algorithms are of primarily three sorts namely Breadth-first search (BFS), Depth-first search (DFS) and Uniform cost search.

Breadth First Search(BFS): In expansive first pursuit, the tree or the diagram is navigated breadthwise. To be more precise, it’s the searching key or the node from where it starts. It then investigates each of its adjoining hubs of the hunt key at that profundity first and afterward moves to the next level of nodes. It is executed utilizing a queue or the line information structure that chips away at the idea of first in, first out (FIFO). It ughly satisfies the property of fulfillment or completeness because it provides a solution only if there is an existence of a proper solution. 

Time complexity: Now, let’s see the time complexity for breadth-first search. It is denoted as bd where b refers to  the branching factor and d is the depth of the tree. For any given node, the average number of child nodes is denoted by the branching factor

Search Algorithms in Artificial Intelligence

Disadvantage: The impediment of this algorithm is that it occupies a ton of memory space since it needs to store each degree of node for the upcoming one. It might also check duplicate nodes.

Example Model: For instance, let us assume the searching node begins from root node A to arrive at destination node G, then it will traverse through each level and move foremostly to the shallowest node. The path will be A-B-C-D-G

Depth First Search(DFS): In this search algorithm, the traversal of the graph or tree is done depth-wise, i.e. similar to BFS, it begins from the search node and then transverse through all the nodes present in that branch, then backtracks itselfIt is carried out utilizing a stack data structure that deals with the idea of last in first out (LIFO). It is more advantageous than BFS because it stores nodes directly and hence less space is required. 

Time Complexity: Its time complexity is also denoted by bd where b is the branching factor and d is the depth. B means the average number of child nodes for any given node.

Search Algorithms in Artificial Intelligence

Disadvantage: The significant detriment is that this algorithm may go on for an endless loop. 

Example Model: Let us consider that the searching algorithm starts from root node A and it needs to reach the destination node at G, then it will explore the deepest node first and traverse through the path A-B-D-G. 

Other than these searching algorithms, there are some other algorithms which are used for regression and classification. One such algorithm is KNN  Algorithm which stores the training data set and classifies new data points based on its similarity. Let us assume that we have two classifications, i.e., Category X and Category Y. We have a point x’ and need to determine on which category this point will lie. To take care of this kind of issue, we need a KNN algorithm which allows us to  distinguish the classification or class of a specific dataset without much hard work. If you are interested to learn more about it, then check out the popular blog on KNN Algorithms.

Uniform Cost Search: Under BFS and DFS, the searching algorithm of Uniform cost search is quite different because in this algorithm, the cost plays the main role. This algorithm follows various ways to arrive at the objective node, so the path having the least cost, calculated as the sum of all costs will be ideal and taken into consideration. It navigates the way in the increasing and expanding order of cost. But if the cost turns out to be the same for all transactions, then it acts similar to breadth first search. 

Search Algorithms in Artificial Intelligence

Time Complexity: It is also denoted bd where b refers to  the branching factor and d is the depth of the tree. For any given node, the average number of child nodes is denoted by the branching factor.

Example Model:  For instance, let us consider that the searching starts from node A of the graph and has to reach the destination node at G, then it will traverse through the path of A-C-G1 and will have the cost as 3.

2. Informed Search Algorithms: These types of algorithms contain the domain information. It contains the description of the problem as well as some additional information such as how far is the destination node located. It is also sometimes referred to as the Heuristic search algorithm. 

It probably won’t give the ideal arrangement consistently, however it will give a decent arrangement in a sensible time. It can take care of complex issues more effectively than uninformed search algorithms. 

It is mostly of two sorts: Greedy Best First Search and A* Search.

Greedy Best First Search: In this sort of algorithm, we build the nearest hub to the objective hub. The closeness factor is generally determined by the heuristic capacity h(x). The hub is extended or investigated when f (n) = h (n). This calculation is carried out through the implementation of priority queue. It is not considered an optimal algorithm for implementation as it has the disadvantage of getting stuck in loops.

Search Algorithms in Artificial Intelligence

Example Model: Suppose, we need to discover the way from root node A to any destination node having least cost and implementing greedy best first search, then, at that point the arrangement to be followed would be A-B-E-H. It will begin with B since it has less expense than C, then traverse to point E since it has less expense than D and finally G2. 

A* Search: It is a mixture of a uniform search algorithm and greedy search algorithm. In this algorithm, the absolute expense (heuristic) which is meant by f(x) is an amount of the expense in uniform expense search signified by g(x) and cost of greedy search indicated by h(x).

f (x) = g (x) + h (x). In this equation, g(x) represents the retrogressive cost which is calculated as the aggregate cost from the starting node till the current node. Whereas h(x) is the forward cost which is inexact of the distance of the destination and current node of the tree.

Ram Tavva

About the author: Senior Data Scientist and Alumnus of IIM- C (Indian Institute of Management – Kolkata) with over 25 years of professional experience Specialized in Data Science, Artificial Intelligence, and Machine Learning.

PMP Certified

ITIL Expert certified APMG, PEOPLECERT and EXIN Accredited Trainer for all modules of ITIL till Expert Trained over 3000+ professionals across the globe Currently authoring a book on ITIL “ITIL MADE EASY”.

Conducted myriad Project management and ITIL Process consulting engagements in various organizations. Performed maturity assessment, gap analysis and Project management process definition and end to end implementation of Project management best practices.