Stack Overflow
To simplify the problem, I have a graph that contains nodes and edges which are on a 2D plane.
What I want to be able to do is click a button and it make the automatically layout the graph to look clean. By that I mean minimal crossing of edges, nice space between nodes, maybe even represent the graph scale (weighted edges).
I know this is completely subjective of what is a clean looking graph, but does anyone know of an algorithm to start with, rather than reinventing the wheel?
Thanks.
I would suggest that you take a look at at graphviz. The dot
program can take a specification of a graph and generate an image of the network for you somewhat "cleanly". The "theory" link on that page gives you some links that might be relevant if you're interested in the theoretical background.
You will find http:// graphdrawing.org / and this tutorial , by Roberto Tamassia , professor at Brown University, quite helpful.
I like a lot Force-Directed Techniques (pp. 66-72 in the tutorial) like the Spring Embedder .
You assume there is a spring or other force between any two adjacent nodes and let nature (simulation) do the work :)
另外JGraph,如果你想在Java中的布局(我在项目上工作)。
链接地址: http://www.djcxy.com/p/29214.html上一篇: 什么是最快,纯粹的Javascript,图形可视化工具包?
下一篇: 堆栈溢出