Skip to content

A web application that provides a visualization of the Graham Scan algorithm.

Notifications You must be signed in to change notification settings

sivakusayan/visual-graham-scan

Repository files navigation

Visual Graham Scan

A web application that provides a visualization of the Graham Scan algorithm. The user can manually add points or randomly generate a collection of points. Afterwards, the animation can be played automatically or step-by-step at the user's pace.

The live app can be found here.

Graham Scan Algorithm

What is the Graham Scan?

The Graham Scan is an algorithm used to compute the convex hull of a point set. It is one of the faster convex hull algorithms, having a time complexity of O(n log n) in the worst case, and can reach as low as O(n) if the points are pre-sorted. Here is a high-level overview of how the algorithm works.

let points = [] of points 
let convexHull = empty []
let startPoint = lowest, rightmost point in points
sort points by polar angle made with startPoint 

for point in points
  push point into convexHull
  if convexHull has a right turn
    pop the point at the vertex of the right turn 
 
return convexHull

Technologies Used

  • React (Library for building UIs)
  • Redux (State Management Tool)
  • Enzyme (Tests React Components)
  • Jest (Tests JavaScript)
  • SASS (CSS Preprocessor)

Running Locally

Prequisites

Make sure you that you have Node.js installed. If you don't have it yet, head over to this link.

Installation and Launch

To get started, first clone the application, and move into the repository:

$ git clone https://github.com/sivakusayan/visual-graham-scan.git
$ cd visual-graham-scan

Afterwards, install all the dependencies and run the application. Enjoy!

$ npm install
$ npm run local

Running Tests

If you want to run the tests, you can do so with the following script:

$ npm run test

You can also only test a specific part of the application if you like:

$ npm run test-algorithm
$ npm run test-components
$ npm run test-containers
$ npm run test-state

About

A web application that provides a visualization of the Graham Scan algorithm.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published