用于转储 yEd 图表的最简单格式
我目前正在尝试在 java 中转储 yEd 的图表。我一直在尝试使用graphml作为格式,但我发现它非常麻烦。特别是,节点的大小不会根据标签的大小进行调整,因此大多数时候标签会比实际文件大。
我可以做些什么来解决这个问题,而无需实际进入并指定每个节点的宽度和高度?
谢谢
I'm currently trying to dump a graph within java for yEd. I've been trying to use graphml for the format, but I've found it to be very cumbersome. Particularly, the size of the nodes will not resize for the size of the label, so most of the time the label will be bigger than the actual file.
Is there anything I can do to remedy this without actually going in and specifying each node's width and height?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一种方法,尽管这种方法使用非官方 API,并且可能不适用于除当前版本(截至撰写时为 3.9.2)之外的任何版本。
在 GraphML 中,在图形级别添加以下键:
正如您所看到的,“AAAAA”显然是一个混淆的类名,并且可能会在构建之间发生变化,并在某种程度上破坏您的脚本。
造成这种不便的原因实际上很简单:yEd 不应该以自动化方式使用(许可证甚至明确禁止纯自动用例),因此针对交互式使用进行了优化。所以点击按钮实际上是有意的。为什么?因为 yEd 是一个基于强大的商业库的免费产品,并且它是免费的,因为高级用户购买了该库的许可证,从而在某种程度上赞助了 yEd 的开发和支持。如果您确实需要以编程方式利用该功能,您应该考虑直接授权该库。
也就是说,您也可以尝试 Excel 导入 - 它会自动为您执行此步骤,但是您必须创建一个 Excel 文件才能开始。
There is a way, although that way uses unofficial API and may not work in any release but the current one (3.9.2 as of writing).
In the GraphML add the following key on the graph level:
As you can see "A.A.A.A.A" obviously is an obfuscated class name and that may change between builds and in a way break your script.
The reason for this inconvenience is actually quite simple: yEd is not supposed to be used in an automated way (the license even explicitly forbids the purely automatic use case) and thus is optimized for interactive use. So clicking on the button is in fact intended. Why? Because yEd is a free product based on a powerful commercial library and it is only free because power users buy a license for the library and thus in a way sponsor yEd's development and support. If you really need to programmatically leverage that power you should take a look at licensing the library directly.
That said, you could also try the Excel import - it will automatically perform this step for you, however you will have to create an excel file to start from.