Skip to content

ehayon/FDGraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##HTML5 Canvas Graph (data structure)

Created by Ethan Hayon

#####Demo

http://ethanhayon.com/Canvas/

#####Get the canvas element from the DOM

var canvas = document.getElementById("canvas");

#####Create a new Canvas object:

var myCanvas = new Canvas(canvas);

#####Create a Graph object:

/* var myGraph = Graph(canvas object, gravitate towards origin) */
var myGraph = new Graph(myCanvas, true);

#####To create a node:

var node = new Node("label", charge);
var node1 = new Node("A", 100);
var node2 = new Node("B", 120);

#####To create a connection between two nodes:

var edge = new Edge(node1, node2)

#####Add objects to the canvas object:

myGraph.add(connection);
myGraph.add(node1);
myGraph.add(node2);

About

Implementation of a force-directed layout

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •