生成软件堆栈图的算法
我正在寻找一种算法的想法,该算法在给定一组非循环依赖关系的情况下生成类似于下图的图表(我使用此图像来表明依赖关系可能很复杂)
(来源:interactivetvweb.org)
I'm looking for ideas for an algorithm that generates a diagram similar to the following, given a set of acyclic dependencies (I'm using this image to show that the dependencies can be complex)
(source: interactivetvweb.org)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
并不总是能够制作这样的图表。 (非循环)依赖关系:
描述了六个顶点上的完全二部图,即 非平面。 对于您显示的图表类型来说,这样做的结果是,图表中的至少一个区域必须分为两个单独的部分,和/或至少其中一个区域不得直接连接到其依赖项。
基于图形的可视化(例如 graphvis)可以避免此问题,其中边可以相互交叉。
用于生成您正在寻找的图表的启发式算法的概要如下:
这不会每次都产生最好的图表(如果这样的概念是明确定义的......),但应该对像你的例子这样的问题做一个合理的工作。
It's not always going to be possible to make such a diagram. The (acyclic) dependency relationship:
describes the complete bipartite graph on six vertices, which is non-planar. The consequence of this for the type of diagram you show is that at least one of the areas in your graph must be either split into two separate pieces, and/or at least one of the areas must not connect directly to its dependent.
This problem is avoided by graph-based visualisation (such as graphvis), where edges can cross each other.
The outline of a heuristic algorithm to produce the sort of diagrams you're looking for is as follows:
This won't produce the best graph every time (if such a concept is even well-defined...) but should do a reasonable job for problems like your example.
虽然不是一种算法(这就是您所要求的),但您可能想看看 NDepend,它执行类似的分析并生成与您所追求的类似的图表:
http://ndepend.com/
(我与 NDepend 没有任何关系)
While not an algorithm (which is what you asked for) you might want to check out NDepend which performs similar analysis and generates similar diagrams to the one you're after:
http://ndepend.com/
(I have no affiliation with NDepend)
STAN4J 从 java 代码生成这种图表。
STAN4J generates this kind of diagrams from java-code.