2

I want to plot hierarchy of match fixtures between various teams in python. Which plot can i use in python?

The output should be like

-----A---|
         |--------A----|
-----B---|             |
                       |-----A
-----C---|             |
         |--------C----|
-----D---|
0

Use the Python moduleGraphViz

The very first examples in the gallery are roughly equivalent to what you want (they are tress, not binary trees, that's all).

enter image description here

An example from my first link shows that this code

from graphviz import Digraph
dot = Digraph(comment='The Round Table'
dot.node('A', 'King Arthur')
dot.node('B', 'Sir Bedevere the Wise')
dot.node('L', 'Sir Lancelot the Brave')
dot.edges(['AB', 'AL'])
dot.edge('B', 'L', constraint='false')
dot.render('test-output/round-table.gv', view=True)

generates

enter image description here

it is easy enough to rotate, to label the connecting lines, etc, etc, and there is comprehensive documentation.

Personally, I love to use GraphViz as it turns text into diagrams, so I run it over log files, etc. It is very popular, very stable (a few decades) and has great support.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.