Skip to content

Graph generator to dynamically generate graphs for DSA practicals

Notifications You must be signed in to change notification settings

JadeMaveric/graph-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Graph Generator

A web app to dynamically generate graphs for DSA practicals sample image

Install and usage instructions

  1. Clone this repo and open index.html
  2. Specify the number of nodes and edges
  3. Hit generate
    • Hit it again if you don't like what you see
  4. Drag any nodes to manually adjust (careful, this a fidgety feature)
  5. Press download to save an image of the graph

The project is essentially a webpage running web workers in the background. While running a local web server would be ideal. The project uses a local (frozen) version of sigma.js to display graphs. So directly opening index.html works fine too. Which means offline use is possible

Features

  • Generate graphs with a prerequisite number of nodes and edges.
  • Automatically and aesthetically arrange nodes
  • Drag and drop nodes for manual adjustment
  • Save the graph as an image file for further use

Abstract Algorithm

  1. The program pseudorandomly generates nodes and edges based on parameters given to it and information it already knows.
  2. These nodes and edges are then passed to a Sigma instance which handles visualisation.
  3. A physics simulation is then run to achieve an aesthetic layout.

Todo

  • Change label type (display each node as an encircled number)
  • Modify layout algorithm so that graphs are arranged on a grid (easier for humans to copy)
  • Let common algorithms (BFS, DFS...) be run on the generated graph

About

Graph generator to dynamically generate graphs for DSA practicals

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published