Skip to content

Commit 90994d5

Browse files
committed
Update README files
1 parent 5825293 commit 90994d5

File tree

2 files changed

+101
-3
lines changed

2 files changed

+101
-3
lines changed

README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Graph-Visualization
2+
3+
This project is about 3D graph visualization with WebGL. The aim of this project is to evaluate the possibilities of graph drawing in WebGL.
4+
5+
It uses [Three.js](https://threejs.org/) for drawing and currently supports a force directed layout.
6+
7+
8+
### Run the example
9+
10+
You can see the examples at http://davidpiegza.github.io/Graph-Visualization/index.html or:
11+
12+
1. Clone or download the project
13+
2. Open the index.html in a WebGL-compatible browser
14+
15+
The `examples` folder contains all examples.
16+
17+
## Project Description
18+
19+
The project consists of
20+
21+
- a graph structure
22+
- a graph layout implementation
23+
- and a graph drawing implementation
24+
25+
### Graph Structure
26+
27+
This is implemented in [graph-visualization/src/graph.js]().
28+
29+
Usage:
30+
31+
```js
32+
// create a graph with maximum number of nodes (optional)
33+
var graph = new GRAPHVIS.Graph({limit: 100});
34+
// create nodes with an id
35+
var node1 = new GRAPHVIS.Node(1);
36+
var node2 = new GRAPHVIS.Node(2);
37+
// add nodes to the graph
38+
graph.addNode(node1);
39+
graph.addNode(node2);
40+
// create edge between nodes
41+
graph.addEdge(node1, node2);
42+
```
43+
44+
Node:
45+
46+
A node has the properties
47+
48+
- `ID`
49+
- `nodesTo`, Array with connected nodes
50+
- `nodesFrom`, Array with connected nodes
51+
- `position`, Object for x, y, z position, default is {}
52+
- `data`, Object with further properties, e.g. properties for a graph layout
53+
54+
For more details have a look at the [source code](https://github.com/davidpiegza/Graph-Visualization/blob/master/src/graph.js).
55+
56+
### Graph Layout
57+
58+
A graph layout has the basic structure:
59+
60+
```js
61+
var Layout = Layout || {};
62+
Layout.ForceDirected = function(graph, options) {
63+
this.init = function() {
64+
...
65+
};
66+
67+
this.generate = function() {
68+
...
69+
};
70+
}
71+
```
72+
73+
The `init()` function is called after graph creation, the `generate()` function is called on each render-call.
74+
75+
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.
76+
77+
The graph layout may extend the nodes and edges with custom properties in the data object.
78+
79+
See [force-based-layout.js](https://github.com/davidpiegza/Graph-Visualization/blob/master/src/layouts/force-based-layout.js) for example usage.
80+
81+
82+
## Contribution
83+
84+
This project uses [Grunt](http://gruntjs.com/) to run several tasks in development. You should have `npm` and `grunt` installed. To install `grunt` run
85+
86+
npm install -g grunt-cli
87+
88+
And to install all dependencies run
89+
90+
npm install
91+
92+
For more info check the [Grunt - Getting started guide](http://gruntjs.com/getting-started).
93+
94+
If you added some changes, run `grunt` to check the code.
95+
96+
## Changelog
97+
98+
See [releases](https://github.com/davidpiegza/Graph-Visualization/releases).

build/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Create minified version
22

3-
Using `uglifyjs`:
3+
Using `grunt`:
44

5-
npm install uglify-js -g
6-
uglifyjs -c -m -- Graph.js webgl-frameworks/Three.js utils/*.js layouts/*.js drawings/*.js > build/graph.min.js
5+
npm install -g grunt-cli
6+
grunt

0 commit comments

Comments
 (0)