0

My data is: [array([5]), array([1,9]), array([0, 4.5, 12.2]), array([-2, 2, 9, 14])]

and I am trying to plot a corresponding "tree" with python. These are the x coord, and theI tried to collect the edges:

    for i in range(0,n+1):
        for j in range(1,i+2):
            if i<n:
                G.add_edge((i,j),(i+1,j))
                G.add_edge((i,j),(i+1,j+1))
    posG={}
    for node in G.node in G.nodes():
        posG[node]=(node[0],n+2+node[0]-2*node[1])

But this do not seem to help me here.

2
  • 1
    Where are you trying to plot it? Could you give a more thorough example in your code, like what is G, and how do you want to plot the binary tree Commented Oct 24, 2020 at 14:03
  • I am trying to customize the tree from here: stackoverflow.com/questions/33712179/… Commented Oct 24, 2020 at 14:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.