English 中文(简体)
图形自动布局算法
原标题:Graph auto-layout algorithm

为了简化这个问题,我有一个图,它包含位于2D平面上的节点和边。

我想做的是点击一个按钮,它会自动布局图形,使其看起来干净。我的意思是边的最小交叉,节点之间的良好空间,甚至可以表示图的比例(加权边)。

我知道这完全是主观的,什么是看起来干净的图,但有人知道一个算法可以开始,而不是重新发明轮子吗?

谢谢

最佳回答

我建议您查看graphvizdot程序可以获取一个图的规范,并在某种程度上“干净”地为您生成网络的图像。我已经链接到”理论“页面,如果你对理论背景感兴趣,它会为你提供一些相关的链接。如果你只是想解决你所面临的布局问题,那么库和工具本身就足够成熟了。

问题回答

您会发现http://graphdrawing.org///a>和本教程Roberto Tamassia教授撰写,非常有用。

我喜欢很多力导向技术(教程中的66-72页),比如Spring Embedder

您假设任意两个相邻节点之间存在弹簧或其他力,并让自然(模拟)执行以下操作:)

我会说是努法尔·易卜拉欣,但您也可以更准确地查看graphviz项目。它包括一个用于构建图形的库(libgraph.pdf)以及一个用于布局图形的库(libgvc.pdf)(只计算每个节点的位置),这样您就可以在自己的UI中显示它。

此外JGraph如果您想要Java中的布局(我负责该项目)。

一个很好的视觉指南,介绍最流行的布局的实际外观:请遵循链接

对于javascript,我推荐Microsoft提供此库:https://microsoft.github.io/msagljs/





相关问题
How to add/merge several Big O s into one

If I have an algorithm which is comprised of (let s say) three sub-algorithms, all with different O() characteristics, e.g.: algorithm A: O(n) algorithm B: O(log(n)) algorithm C: O(n log(n)) How do ...

Grokking Timsort

There s a (relatively) new sort on the block called Timsort. It s been used as Python s list.sort, and is now going to be the new Array.sort in Java 7. There s some documentation and a tiny Wikipedia ...

Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Enumerating All Minimal Directed Cycles Of A Directed Graph

I have a directed graph and my problem is to enumerate all the minimal (cycles that cannot be constructed as the union of other cycles) directed cycles of this graph. This is different from what the ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签