简体   繁体   中英

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. From what I've seen, Networkx only has a Graph object (only undirected edges) and a DiGraph object (for directed edges only). Is there a way to include directed edges in a undirected graph in Networkx and/or vice versa?

networkx has no mixed graph handling. 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. 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM