I want to construct a directed graph using python. How do I get the arcs to show arrowheads?
import graphviz and gv
import pylab
g1 = gv.Graph(format='png')
g1.node("A")
g1.node("B")
g1.edge("A", "B", arrowhead='normal')
g1.edge_attr.update(arrowhead="normal", arrowsize='2')
g1.graph_attr.update(directed="true")
g1.view()
print(g1.source)
filename = g1.render(filename='img/g1')
pylab.savefig('filename.png')
What I get out is a graph but no arrow heads. I want the line between A and B to be an arrow pointing to B:
The line
print(g1.source)
gives
graph {
graph [directed=true]
edge [arrowhead=normal arrowsize=2]
A
B
A -- B [arrowhead=normal]
}