1

I was looking for a way to create Digraph instance using graphviz package from existing .dot (or .gv) file, is that possible?

I want to do that in order to add/change attributes in the graph and then render altered graph.

NOTE:

1) I tried loading .dot file using Source class, however it does not seem to have methods to change the loaded graph. (Mentioned here How to parse a DOT file in Python).

2) I cannot use any other packages (i.e. pygraphviz, pydot etc.)

3) The .dot file contains a correctly formatted graph.

Laurynas Tamulevičius
  • 1,479
  • 1
  • 11
  • 25

1 Answers1

0

You could parse the .dot source file using ANTLR4 and this grammar., and the python binding for ANTLR4. I use C# myself with ANTLR4 but believe there is a python implementation.

TomServo
  • 7,248
  • 5
  • 30
  • 47