Skip to content

This repository includes a study that aims to handle the shortest path problem with UCS paradigm. Detailed info in ReadMe

License

Notifications You must be signed in to change notification settings

asrinoztin/shortest_path_with_ucs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

In this project, a road map of certain Turkish cities will be used to apply the Uniform Cost Search (UCS) method to find the shortest route between two cities. Python will be used for the implementation, and the application will be needed to adhere to certain standards. We will outline the UCS algorithm, describe how priority queues are utilized in this project, look at the source code, and then show the test results in this report.

Ekran Resmi 2023-05-21 18 39 57

Uniform Cost Search Algorithm

To determine the path that has the lowest cost between two nodes in a network, computer scientists use a variation of the Breadth-First Search (BFS) technique known as Uniform Cost Search. UCS, in contrast to BFS, gives each edge a cost value and prioritizes paths with lower cumulative costs during the search. BFS treats all edges equally. UCS is therefore ideal and always discovers the shortest path if one exists.

Priority queues are used by UCS to organize the untried pathways. The path with the lowest cost is always at the head of the priority queue because it is sorted by path cost. This indicates that UCS investigates the paths in ascending cost order, always choosing the one with the lowest cost at each stage. This allows UCS to efficiently traverse the graph and identify the best path.

UCS is a significant method utilized in numerous computer science applications, including route planning, machine learning, and artificial intelligence. It is an effective tool for addressing complex problems and optimizing solutions since it can locate the shortest path in a graph.

Usage of Priority Queues in the Project

Priority queues are employed in this project to carry out the UCS algorithm. A tuple (0, start, []) is used to initialize the priority queue. The first value in the tuple indicates the total cost of the path, the second value is the current node, and the third value is a list of all the nodes that have been visited. The first value of the tuple, which is the path's total cost, determines the priority queue's order. The algorithm dequeues the path with the lowest cost from the priority queue after each iteration, investigates its neighbors, and then adds them, with their respective costs, to the priority queue.

About

This repository includes a study that aims to handle the shortest path problem with UCS paradigm. Detailed info in ReadMe

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages