1

My task is to generate a graph from a dot file (using pydot) and then convert the same as networkx graph. The problem that I faced was that the attributes of Graph (as I have given in the .dot file) is not present in the networkx graph. I also used read_dot() function which is again an error. My code is successfully working to visualize graphs but not its attribs.

My code is:

import pydot
import networkx as nx
(graph,) = pydot.graph_from_dot_file('1.dot')
G = nx.nx_pydot.from_pydot(graph)
nx.get_node_attributes(G,'1')

My output is {}

Pls help me to fix the problem

Thanks from Mathan :)

  • The example is incomplete: what are the contents of the file `1.dot`? Please provide a [minimal working example](https://stackoverflow.com/help/mcve). – 0 _ Oct 14 '17 at 06:42

0 Answers0