GithubHelp home page GithubHelp logo

graph-search's Introduction

Graph Search

Introduction

This practical final project is part of the Data Structures & Algorithms course in the field of Data Science at VNUHCM - University of Science.

The majority of the code for this project was provided by my lab instructor, Mr. Nguyen Bao Long. In this project, my main contribution is in the SearchAlgorithms.py file.

image

Graph search is the process of traversing or exploring a graph data structure to find a specific element or to solve a particular problem. A graph is a collection of nodes (vertices) connected by edges.

There are various algorithms and strategies for graph search:

  • Breadth-First Search (BFS): This algorithm explores all the vertices at the same level before moving to the next level. It starts from a given source node and visits all its neighbors before moving to the next level of neighbors.
  • Depth-First Search (DFS): DFS explores as far as possible along each branch before backtracking. It starts from a given source node and explores as deep as possible, visiting the first unvisited neighbor before backtracking.
  • Uniform Cost Search (UCS): UCS is an uninformed search algorithm that explores the graph by considering the cost associated with each edge.
  • Dijkstra's Algorithm: This algorithm is used to find the shortest path between two nodes in a weighted graph. It starts from a source node and iteratively selects the node with the minimum distance, updating the distances of its neighbors.

Usage

Installation

To install the correct version of Python (version 3.9.12 or higher) for this project, you can visit the following link to download and install.

Clone the project to your local machine:

git clone https://github.com/TuanTran0910/Graph-Search.git
cd Graph-Search

To install the necessary libraries, you can use the following command:

pip install -r requirements.txt

Search node in Graph

To run the searching process, we have to run this following command:

python main.py --algo <algo> --start <start> --goal <goal>

Where,

  • "--algo ": This parameter specifies the algorithm algo to be used. There are four algorithms that can be used in this project (DFS, BFS, UCS, Dijkstra)
  • "--start ": This parameter specifies the starting node start or vertex for the graph search.
  • "--goal ": This parameter specifies the goal node goal or vertex that the search aims to reach.

For example, to perform a graph search using the Depth-First Search algorithm, starting from node 71 and aiming to reach node 318:

python src/main.py --algo DFS --start 71 --goal 318

Contribution

This project is a collaborative effort, and we would like to acknowledge the contributions of the following individual:

  • Nguyen Hai Ngoc Huyen

I would like to express my gratitude to my teammate for her hard work and dedication to this project. Without her efforts, this project would not have been possible.

graph-search's People

Contributors

tuantran0910 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.