Commit Graph

12 Commits

Author SHA1 Message Date
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