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.

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your suggestion. I figured that my project had pydot installed, hence I went ahead with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.