GithubHelp home page GithubHelp logo

web5design / graph-visualization Goto Github PK

View Code? Open in Web Editor NEW

This project forked from davidpiegza/graph-visualization

1.0 3.0 1.0 491 KB

3D graph visualization with WebGL / Three.js

Home Page: http://graphit-live.herokuapp.com/

License: Other

graph-visualization's Introduction

Graph-Visualization

This project is about 3D graph visualization with WebGL. The aim of this project is to evaluate the possibilities of graph drawing in WebGL.

This project uses Three.js for drawing and currently supports a force directed layout.

Run the example

  1. Clone or download the project
  2. Open the index_sample.html in a WebGL-compatible browser

You may copy the index_sample.html to index.html and customize it.

Project Description

The project consists of

  • a graph structure
  • a graph layout implementation
  • and a graph drawing implementation

Graph Structure

This is implemented in graph-visualization/Graph.js.

Usage:

var graph = new Graph({limit: 100});  // set maximum number of nodes, optional
var node1 = new Node(1);              // create nodes with id
var node2 = new Node(2);
graph.addNode( node1 );               // add nodes
graph.addNode( node2 );
graph.addEdge( node1, node2 );        // create edge between nodes

Node:

A node has the properties

  • ID
  • nodesTo, Array with connected nodes
  • nodesFrom, Array with connected nodes
  • position, Object for x, y, z position, default is {}
  • data, Object with further properties, e.g. properties for a graph layout

For more details have a look at the source code.

Graph Layout

A graph layout has the basic structure:

var Layout = Layout || {};
Layout.ForceDirected = function(graph, options) {
  this.init = function() {
    ...
  };
  
  this.generate = function() {
    ...
  };
}

The init() function is called after graph creation, the generate() function is called on each render-call.

The graph layout gets the created graph and calculates new positions for the nodes. The generate() function is called repeatedly, so there must be a stop condition after finished calculation.

The graph layout may extend the nodes and edges with custom properties in the data object.

See force-based-layout.js for example usage.

graph-visualization's People

Stargazers

JT5D avatar

Watchers

JT5D avatar James Cloos avatar  avatar

Forkers

imclab

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.