Git Product home page Git Product logo

flutter_path_finder_algorithms's Introduction

Flutter Path Finder

This Flutter package provides an implementation of path-finding algorithms including Breadth-First Search (BFS), Depth-First Search (DFS), and A* Search. It also includes a visualization component to help you visualize the algorithms in action.

Path Finder Demo

Algorithms Implemented

  1. A* Search A* is a widely used path-finding algorithm that combines the advantages of both Dijkstra's algorithm and Greedy Best-First Search. It is known for its efficiency and accuracy in finding the shortest path.

  2. Breadth-First Search BFS is a simple and effective algorithm for exploring all possible paths in a graph systematically. It guarantees finding the shortest path when all edges have the same weight.

  3. Depth-First Search DFS is another graph traversal algorithm that explores as far as possible along each branch before backtracking. It is not guaranteed to find the shortest path, but it can be useful in certain scenarios.

How to Use

  1. Clone or download this repository to your Flutter project.
  2. Import the necessary path-finder class in your Dart file.
  3. Create a grid of nodes where you want to find the path.
  4. Instantiate the path-finder of your choice (A*, BFS, or DFS).
  5. Run the path-finding algorithm by calling the call method with the graph, start node, and end node as parameters.
// Create a grid of nodes (List<List<Node>> graph) Instantiate the A* path-finder.
final BasePathFinder pathFinder = AStarPathFinder();

// Run the A* algorithm.
pathFinder(graph, startNode, endNode).listen((graph) {
  // Do something with the graph.
});

// Get shortest path.
pathFinder.getShortestPath(endNode).listen((data) {
  // Do something with the path.
});

You can customize the delay between steps of the algorithm by providing a Duration as an optional parameter.

Visualization

The repository includes a Flutter app that visualizes the path-finding algorithms in action. It displays a grid with obstacles, the start and end points, and the path found by the selected algorithm. You can use this app as a reference for integrating the path-finding algorithms into your Flutter project.

Node Class

The Node class represents a node on the grid. It contains information about its position, whether it has been visited, whether it is a wall (obstacle), and other properties required for path finding.

PathFinderPainter Class

The PathFinderPainter class is responsible for rendering the grid, nodes, and path on the screen. It uses custom painting to visualize the algorithm's progress.

License

This project is licensed under the MIT License - see the LICENSE file for details.


flutter_path_finder_algorithms's People

Contributors

hamed-rezaee 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.