import graphviz as gv
# ノードのリスト
text1 = 'this is sample text \n hello'
nodes = [text1, 'B', 'C', 'D', 'E', 'F']
# Digraphオブジェクトを作成
graph = gv.Digraph(format='svg', filename="output/mygraph.gv",
graph_attr=dict(rankdir='LR', splines='ortho'),
node_attr=dict(shape='box'))
# ノードを5つずつ追加
graph.node(nodes[0])
graph.node(nodes[1])
graph.node(nodes[2])
graph.node(nodes[3])
graph.node(nodes[4])
graph.node(nodes[5])
# エッジを追加
graph.edge(text1, 'B')
graph.edge('B', 'C')
graph.edge('C', 'D')
graph.edge('D', 'E', constraint='false')
graph.edge('E', 'F')
graph.view()