![]() |
How to draw a tree in garphviz - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: How to draw a tree in garphviz (/thread-17946.html) |
How to draw a tree in garphviz - mandana - Apr-30-2019 I want to draw a tree in python graphviz. I have data in excel with 3 columns. The first column is Tail, the second is Head and the third column is Label of edges. I know how to draw tree in graphviz but the data is big and i can not identify by hand. I want to use loop 'for' to identify nodes,edges and labels. How can i do this? I wrote these code for small data.but it doesn't work. from graphviz import Digraph d=Digraph() node=[0,1,2,3,4] //this data is big but i did for small and it imports from excel edges=['01','02','13','14'] //this data is big but i did for small for i in range(1,6): d.node('node','node') for j in range(1,6): d.edges(['edges']) print(d.source) RE: How to draw a tree in garphviz - Larz60+ - Apr-30-2019 see: https://graphviz.readthedocs.io/en/stable/examples.html#btree-py RE: How to draw a tree in garphviz - mandana - May-01-2019 Thank you very much. I found how to create 300 nodes but i don't know how to make them. how to make edges. for example in d.edges('tail','head',label='x12')i want to call 'tail' ,'head' and label from excel |