Using graphviz all states/elements in the list are not displayed in the state diagram/flow chart

Viewed 16

I am trying to print all the elements sequentially inside the flow diagram using graphviz, but I am noticing not all elements are captured in the flow chart.

import os
import re
import graphviz
os.environ["PATH"] += os.pathsep + 'C:/Program Files/Graphviz/bin/'

g = graphviz.Digraph('G', filename='flow.gv')

states = ["A","B","C","D","E","F","G","H"]

for i in range(len(states)-1):
    g.edge(states[i],states[i+1])
    g.view()

Output I am getting in the pdf has states A to D one after other..

In the terminal I get below error: Error: Could not open "flow.gv.pdf" for writing : Permission denied

what can be done? Any other suggestion about package will also be helpful

0 Answers
Related