Skip to content

OP-Patel/Fruchterman-Reingold_Visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Created a Fruchterman-Reingold Visualizer using C and SDL.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published