Robert Machmer
af7f49a2ad
Remove constructor
2016-01-09 05:08:32 +01:00
Robert Machmer
7901ac1381
Add setters for replacing the default Edge and Node classes
...
This can be handy if the user wants to extend the functionality of those
classes. They can simply be inherited in a new class with that new class
being used in the Graph then.
2016-01-09 05:06:54 +01:00
Robert Machmer
73b74ca3fe
Add Edge and Node classes to init.lua
...
This way they can be required separately from the Graph class.
2016-01-09 05:03:45 +01:00
Robert Machmer
4e5e302d32
Fix constructor using the old addEdge function
2016-01-09 04:02:03 +01:00
Robert Machmer
9017b40da9
Add function for adding an edge between nodes referenced by their IDs
2016-01-09 03:41:31 +01:00
Robert Machmer
732037bd04
Rename self:addEdge to self:connectNodes
2016-01-09 03:35:51 +01:00
Robert Machmer
436ec9f78f
Add function for checking if a node ID already exists
2016-01-09 02:02:44 +01:00
rm-code
3adb350ca3
Update LICENSE.md
2016-01-03 11:24:51 +01:00
Robert Machmer
99850a423a
Update documentation
2016-01-03 02:43:56 +01:00
Robert Machmer
dba6a49587
Remove name attribute in Node class
...
Seems kind of redundant to have both an id and a name attribute.
2016-01-03 02:33:03 +01:00
Robert Machmer
e6154ba5ea
Allow anchor flag to be set when a Node is created
2016-01-03 02:32:57 +01:00
Robert Machmer
f5931d5ce8
Return new node when using graph:addNode
2016-01-02 15:27:30 +01:00
Robert Machmer
4bf0d0473d
Remove attraction points
2016-01-02 15:19:53 +01:00
Robert Machmer
78050c9af7
Add anchor nodes
...
Nodes set as anchors won't be affected by the force directed layout.
They can be used to fixate the graph to a certain area.
2016-01-02 15:19:35 +01:00
Robert Machmer
47b7624261
Extend graph constructor to handle node tables
...
The nodes can either be a sequence of strings or a sequence of tables
containing id, name, x and y values.
2015-12-25 00:50:36 +01:00
Robert Machmer
2a258a96d5
Add nodes without name parameter
2015-12-24 22:59:15 +01:00
Robert Machmer
59a055da99
Add optional name parameter for Nodes
...
This parameter can be accessed via the getName getter. If no value is
passed to the constructor the name variable will default to the id.
2015-12-24 16:56:40 +01:00
Robert Machmer
35868a4360
Add getter which returns a node based on a given id
2015-12-24 03:26:08 +01:00
Robert Machmer
729afd59af
Add function for checking if a node with a given id exists
2015-12-24 03:25:04 +01:00
Robert Machmer
ebb82093fb
Add function for getting the x and y coordinates of the graph's center
2015-12-24 00:41:18 +01:00
Robert Machmer
6532d97cca
Add function for getting the graph's boundaries
2015-12-24 00:41:12 +01:00
Robert Machmer
ac060cda1e
Turn library into a package
2015-12-24 00:06:44 +01:00
Robert Machmer
f47effd6fb
Create nodes inside of Graph class
2015-12-24 00:06:39 +01:00
Robert Machmer
9cf1af9540
Add docs
2015-12-23 09:03:21 +01:00
Robert Machmer
24246eaf54
Add function for creating a "global" attraction point
...
This point won't show up in the graph itself and can not be interacted
with. Instead it only has the purpose to attract all nodes in the graph.
This can be useful if you have unconnected nodes and want to prevent
them from floating away.
2015-12-23 08:54:18 +01:00
Robert Machmer
6b5bff63c3
Remove code for drawing the graph
...
Instead the draw function now takes a parameter of type function to
which it passes the edges and nodes tables. This means the user can (and
has to) handle the drawing of the graph.
2015-12-23 08:38:52 +01:00
Robert Machmer
1ad54dd376
Improve function to create a new graph based on data
...
The random function is now seeded properly and uses the x, y, w, and h
parameters passed to the function to determine in what range to randomly
place the nodes.
2015-12-22 02:52:16 +01:00
Robert Machmer
fd957a3881
Use a constant mass for nodes
...
This eventually should be made customizable.
2015-12-21 13:27:27 +01:00
Robert Machmer
54a7a295ec
Throw error when node ID is already taken
2015-12-21 13:01:35 +01:00
Robert Machmer
e4d34d4281
Add functions to remove a node from the graph
...
When a node is removed, all edges to and from it will be deleted as
well.
2015-12-21 12:42:52 +01:00
Robert Machmer
89b6c16974
Throw error if added edges are invalid
...
This is the case if both the origin and the target of the edge point to
the same node or if an edge already exists between two nodes.
2015-12-21 12:36:46 +01:00
Robert Machmer
805278d67a
Add first working draft of the force directed graph
2015-12-21 12:13:36 +01:00
Robert Machmer
ff55890510
Initial commit
2015-12-20 11:34:43 +01:00