You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-7Lines changed: 11 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,18 @@
1
1
# Graphoon
2
2
3
-
A force directed algorithm written in Lua.
3
+
A force directed graph algorithm written in Lua.
4
4
5
+
## Introduction
6
+
7
+
_Graphoon_ emerged from the graph calculation code used in both [LoGiVi](https://github.com/rm-code/logivi) and [LoFiVi](https://github.com/rm-code/lofivi).
8
+
9
+
A force directed graph layout is achieved by simulating physical forces, which push and pull each node in the graph until a nice layout is found.
5
10
6
11
## Basic Usage
7
12
8
13
The basic idea is that you create a new graph object, to which you can then add nodes and edges.
9
14
10
-
```
15
+
```lua
11
16
localGraphLibrary=require('Graphoon').Graph
12
17
13
18
graph=GraphLibrary.new()
@@ -20,9 +25,9 @@ By itself Graphoon only provides functionality for creating the graph and calcul
20
25
21
26
It provides a ```draw``` and ```update``` function, which can be used to easily write your own rendering code.
22
27
23
-
The ```draw``` function should be called with two callback functions. The first callback will be used for all nodes and the second one for all the edges.
28
+
The ```draw``` function should be called with two callback functions. The first callback will be used for all nodes and the second one for all the edges.
24
29
25
-
```
30
+
```lua
26
31
graph:draw( function( node )
27
32
localx, y=node:getPosition()
28
33
drawCircle( 'fill', x, y, 10 )
@@ -44,15 +49,14 @@ Anchors can be used to attach a node to a certain position on the screen. This c
44
49
45
50
This can either be done directly via the constructor of the node:
0 commit comments