View Algorithms in the Browser! - Built with ReactJs
An interactive visualiser which demonstrates the pro's and con's of various graph solving algorithms.
It is deployed on Heroku here:
The Algo-Visualiser is a web app built in ReactJS that shows how various graph traversal algorithm work. It was built by Bassel Al-Sayed and Tom Walker out of a mutual wish to understand ReactJS and GPS systems and these algorithms together.
git clone https://github.com/Walker-TW/Algorithm-Visualizer.git
yarn build, then
serve -s build.
yarn global add serveor
npm i -g serve, it's handy to have around.
At time of writing, jest can be buggy with coverage in watch mode so for accurate coverage run
The algorithms demonstrated within the project are all graph traversal algorithms.
An algorithm that is weighted and will always find the shortest path. Works by spreading out and determining the shortest 'distance' to the final node by adding up the traversed weights.
An upgraded version of Dijkstra that takes the distance value of each node and combines it with a heuristic value to determine not just the distance to the finish node but the direction that it should take. Two types of heuristics are used in our project the Manhattan distance & the Euclidean distance. It will always find the shortest path when using the correct heuristic.
AKA 'as the crow flies' is a heuristic used in most straight line mazes. It uses the Pythagorean theorem on a triangle created from the two points that you wish to get to Point A (start point) & Point B (destination).
sqrt((x2-x1)^2 + (y2-y1)^2)
However because our grid is only traversable on horizontal or vertical vertices using this heurtistic will NOT always give the shortest path, though it will be much faster than other heuristics.
AKA the taxi-cab distance will only work on a grid system unlike the euclidean, this heuristic is calculated by taking the absolute values of subtracting the x & y values of two points on our triangle and then adding the result together. This allows a better relative distance.
|(x2-x1)| + |(y2-y1)|
Because Manhattan moves only in horizontal or vertical verticies it will always find the shortest path. However it will be much slower than Euclidean so if speed is an issue (especially in huge graphs) while accurancy is not choose Euclidean.
Is a graph traversal algorithm which will search all neighbour nodes (in this projects case north/east/west/south) of the main node before moving onto the next level. This will cause a spreading out effect and means that along a maze BRS will explore all diversions that it comes across. It will find the shortest path.
The brother of Breadth First Search it will not explore all neighbour nodes instead exploring all along a branch before backtracking to other non-visited nodes. Depth first search is the only algorithm listed which will NOT find the shortest path.
Distributed under the MIT License. See
LICENSEfor more information.
This project was inspired by a video from Clément Mihailescu please visit his youtube channel here