gpt4 book ai didi

python - 在python中处理yEd graphml文件

转载 作者:行者123 更新时间:2023-12-04 08:52:05 27 4
gpt4 key购买 nike

我想得到一个列表 全部 yEd 创建的 graphml 文件中的节点和一些属性(例如标签名称),而不管它们在图中的位置。这已经部分处理了( Processing XML file with networkx in pythonHow to iterate over GraphML file with lxml )但是当你在 yEd 中“分组”节点时没有 - 我在分组中有很多分组。

已经尝试过 networkx 和 lxml,但没有使用建议的简单方法获得完整的结果集 - 关于优雅的解决方法以及使用哪个库的任何建议,而不是递归遍历树并识别组节点并再次向下钻取。

示例:

当您有分组时,使用 networkx 的非常简单图形的示例输出:

('n0', {})
('n1', {'y': '0.0', 'x': '26.007967509920633', 'label': 'A'})
('n0::n0', {})
('n0::n1', {})

Simple representation of the graph

最佳答案

我想你可以试试这个。

根据作者的说法,它是一个 Python 库...

provides an easy interface that lets you specify how a graph should look, and generates corresponding graphML that can be opened in yEd.



https://github.com/jamesscottbrown/pyyed

希望这可以帮助!

干杯!

关于python - 在python中处理yEd graphml文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27487872/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com