I am currently working on a GUI with AngularJS, which contains a graph given with it's nodes and connections in a javascript objects like this:
Nodes = [{'name': 'name1', x: 0, y: 0, id: 1}, {'name': 'name2', x: 0, y: 0, id: 2}, {'name': 'name3', x: 0, y: 0, id: 3}];
Connections = [{'from': 1, 'to': 2}, {'from': 1, 'to': 3}];
What I need to do, is give the x and y values for every node. At the moment I am using a simple offset to avoid overlapping and render node-by-node, but I would like to calculate x and y values for each node to have a proper layout.
Is there an algorithm, that I give my nodes and connections to and returns with a layout (x, y values for every node), which is better looking than my simple solution?
I have tried D3, but I am already using a third party library for the graph and it's hard to integrate it, so a optimal solution would be to simply give the coordinates for the current library's data structure (Nodes and Connections).