NetworkX

Previous topic

networkx.pygraphviz_layout

Next topic

networkx.to_pydot

Quick search

networkx.from_pydot

from_pydot(P)

Return a NetworkX Graph or DiGraph from a pydot graph.

The Graph X will have a dictionary X.graph_attr containing the default graphviz attributes for graphs, nodes and edges.

Default node attributes will be in the dictionary X.node_attr which is keyed by node.

Edge attributes will be returned as edge data in the graph X.

Examples

>>> G=nx.complete_graph(5)
>>> P=nx.to_pydot(G)
>>> X=nx.from_pydot(P)

If you want a Graph with no attributes attached use

>>> G=nx.Graph(X)

Similarly to make a DiGraph without attributes

>>> D=nx.DiGraph(X)