I ran into similar problems a while ago. The solution I finally came up with is a small js library that did a great job of this, namely Dracula. A.
Here is a link to the library: https://github.com/strathausen/dracula
Given your needs, all you have to do is something like:
var g = new Graph(); g.addEdge('author', 'create'); g.addEdge('author', 'reader'); g.addEdge('author', 'admin'); // add here the other edges. var layouter = new Graph.Layout.Spring(); layouter.layout(); var renderer = new Graph.Renderer.Raphael('#canvas', g, 400, 300); renderer.draw();
For more information, I will let you deal with the documentation.
Hope this helps.
[ADDITION]
I would add that, generally speaking, the question of displaying nodes and arrows doesn't really matter, using svg makes it almost trivial. But things get complicated when you want to organize the display of nodes with rules such as "try to minimize the number of intersecting boundaries," "display children below their parent," etc., which all require complex mathematics.
I do not think that Dracula allows you to customize such rules. However, given your comment, I think it might be too complicated a way to make the layout look like a vertical tree, as it is an acyclic graph (at least it seems). But then you have to go through your own library for this.
source share