NetworkX

Previous topic

networkx.MultiDiGraph.copy

Next topic

networkx.MultiDiGraph.subgraph

networkx.MultiDiGraph.to_undirected

MultiDiGraph.to_undirected()

Return an undirected representation of the digraph.

Returns:

G : MultiGraph

An undirected graph with the same name and nodes and with edge (u,v,data) if either (u,v,data) or (v,u,data) is in the digraph. If both edges exist in digraph and their edge data is different, only one edge is created with an arbitrary choice of which edge data to use. You must check and correct for this manually if desired.

Notes

This is similar to MultiGraph(self) which returns a shallow copy. self.to_undirected() returns a deepcopy of edge, node and graph attributes.