Skip to main content
100%

Creates a force directed graph with more attractive force

✓ Published0🌍 Public
Aaabajaj2
Last edited Mar 3, 2018
Created on Mar 3, 2018

This visualization implements a force-directed graph layout using p5.js, rendering a network of 50 nodes connected by edges from a CSV dataset. The graph algorithm applies repulsive forces between all node pairs and an attractive force proportional to the cube of the distance divided by the spring constant k, creating a notably stronger pull between connected nodes than typical implementations. Nodes are initially placed randomly within a 2000x2000 canvas and gradually settle into a stable arrangement as the algorithm iterates five times per frame. The visualization supports mouse interaction: hovering over a node displays its numeric ID as a tooltip and highlights connected edges in bold black, while inactive edges remain grey. The algorithm uses a custom force-directed layout with attractive forces calculated as x³/k and repulsive forces as k²/x, balanced by the optimal distance constant k derived from the canvas area and vertex count.

AI-generated description

Similar vizzes