Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 2.59 KB

README.md

File metadata and controls

43 lines (33 loc) · 2.59 KB

Fruchterman-Reingold Visualizer

What is the Fruchterman-Reingold algorithm?

The Fruchterman-Reingold algorithm is a type of force-directed graph drawing algorithm designed to arrange the nodes of a graph in a two-dimensional or three-dimensional space in an aesthetically pleasing manner. It aims to ensure that the edges between nodes are of approximately equal length and that edge crossings are minimized. This is achieved by assigning attractive and repulsive forces to the edges and nodes based on their positions and then adjusting these positions to simulate motion or minimize the overall energy of the system (this is measured through system temperature and cooling factors), resulting in a more visually appealing graph layout.

The Visualizer

The visualizer is fully programmed in C using SDL2 (Simple DirectMedia Layer) for interactivity and visuals.

Keybind

Key(s) Action
WASD Grid panning, allows for moving the demo grid and nodes
Mouse Scoll Adjusts zoom level on demo grid
LEFT/RIGHT Arrow Keys One frame adjustments (rev or fwd)
Space Bar Play/Pause

There will be auto-generated nodes and edges on the visualizer upon starting. To generate new randomized node locations, click the "Generate Nodes" button.

Usage

Make sure you have both SDL2 and SDL2_ttf installed on your system. You can usually install them via your package manager
i.e MacOS using brew install sdl2 sdl2_ttf. Also ensure you have a C compiler and make installed or you may have to do some adjustments to the MakeFile.

Start by cloning and navigating to the project,

git clone https://github.com/OP-Patel/Fruchterman-Reingold_Visualizer.git
cd Fruchterman-Reingold_Visualizer

Then simply write,

make
./build/debug/play

Examples

Below are some examples of the Fruchterman-Reingold algorithm at play using different input graphs.

Fruchterman-Reingold GraphViz
GIFMaker_me (1) Large-scale Graphimage
GIFMaker_me (2) K6 Graph
image
GIFMaker_me (3) Binary Tree
image