python - 如何将子图添加到现有图作为 networkx 中的边?
问题描述
我正在尝试动态构建这样的图表:
@property
def graph(self):
g = nx.DiGraph()
g.add_node(self)
for child in self.children_pivots:
g = nx.compose(g, child.graph)
g.add_edge(self, child)
return g
其中 children_pivots 是与 self 相同对象类型的列表。似乎不支持此功能,或者我在文档中错过了它。我是否必须手动迭代组件并构建图表?有没有简单明了的方法可以说:这是一个图,将此图的根添加为由该边连接的新节点。
解决方案
推荐阅读
- continuous-integration - 带有 GitLab CI/CD 和 vsphere-iso 的自动化 Ubuntu 20.04 模板
- python - Shell - python 脚本输出中的新行分隔符
- regex - 可以从postgresql连接字符串中提取用户名和密码的正则表达式?
- .htaccess - .htaccess,引擎重写,不管前面的一切,引用同一个文件夹
- python - Discord.py 在加入时向成员发送消息并赋予他们角色
- plot - 在 SAS 中绘制聚类分析结果
- java - Apache 服务器上的 TLS
- javascript - Javascript:根据模式拆分数组:项目 1、5、10,然后是 2、6、11,然后是 3、7、12
- android - 重复类 org.xmlpull.v1.XmlPullParser Android
- linux - VS Code N:跳过获取配置文件'main/binary-arm64/Packages'