There are several excellent tutorials for generating .gv files for graphviz and then creating the approprate graph using the render command. However, I am looking to simply take a pregenerated .gv file and call graphviz and generate the image. One problem I was noticing with the render command was that it performs the action of saving the .gv file and therefore deletes the file that the user specifies.
So my question again is:
How can I call graphviz to generate the graph from a pregenerated .gv file rather than creating the .gv file with graphviz commands?
Example:
Existing .gv file G.gv
digraph G {
A -> B
B -> C
C -> A
B -> D
}
Sudo Python Code:
import graphviz
graphvix.dot('G.gv', view=True) # .gv file is read and plot is produced and shown
Other info: Yes I have Graphviz installed and yes using render the way various tutorials use it works I just can't seem to pinpoint how to just call graphviz... Thanks!
So simple, so easy, so perfectly perfect.
from graphviz import Source
Source.from_file('file.gv')