Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

from_pydot

from_pydot(P)[source]

Return a NetworkX graph from a Pydot graph.

Parameters:

P : Pydot graph

A graph created with Pydot

Returns:

G : NetworkX multigraph

A MultiGraph or MultiDiGraph.

Examples

>>> K5=nx.complete_graph(5)
>>> A=nx.to_pydot(K5)
>>> G=nx.from_pydot(A) # return MultiGraph
>>> G=nx.Graph(nx.from_pydot(A)) # make a Graph instead of MultiGraph