[英]Is it possible to add undirected and directed edges to a graph object in networkx?
I'm working on implementing an algorithm to determine the graphical structure of a dataset. 我正在努力实现一种确定数据集图形结构的算法。 The dataset could have undirected or directed edges between variables.
数据集在变量之间可能具有无向或有向的边缘。 I could create my own graph object in Python, but I was curious if Networkx has this capability.
我可以用Python创建自己的图形对象,但我很好奇Networkx是否具有此功能。 From what I've seen, Networkx only has a Graph object (only undirected edges) and a DiGraph object (for directed edges only).
从我所看到的,Networkx仅具有一个Graph对象(仅无向边缘)和DiGraph对象(仅针对有向边缘)。 Is there a way to include directed edges in a undirected graph in Networkx and/or vice versa?
是否可以在Networkx中将有向边包括在无向图中,反之亦然?
networkx
has no mixed graph handling. networkx
没有混合图形处理。 There were discussions about it , but the implementation had an impact on the whole library, so it was suspended. 对此进行了讨论 ,但是实现对整个库都有影响,因此已暂停。 As I know,
graph-tool
and igraph
has no this functionality too. 据我所知,
graph-tool
和igraph
也没有此功能。 If you are not satisfied by bidirected edges as undirected, I am afraid you should not use Python libraries, because it is impossible to have both directed and undirected edges in the most popular Python graph libraries: networkx
, graph-tool
and igraph
. 如果您对双向边缘的不定向
networkx
到不满意,恐怕您不应该使用Python库,因为在最流行的Python图形库中,不可能同时包含有向和无向边缘: networkx
, graph-tool
和igraph
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.