Hello

Please note that this kind of question should rather be asked on 
ask.sagemath.org.

You can use the methods get_pos and set_pos

sage: t=graphs.RandomTree(40)
sage: tp=t.plot(layout='tree', tree_orientation='right', edge_labels=True, 
tree_root = 0,save_pos=True)
sage: positions = t.get_pos()

Then 'positions' contains the coordinates of the vertices. You can use them 
for a modified graph as follows.

sage: g=t.copy()
sage: g.add_edge((14,23))       
sage: g.set_pos(positions)

yours,

Frederic


Le dimanche 28 juin 2015 17:46:07 UTC+2, Hannah Lorrimore a écrit :
>
> Hi,
>
> I'm doing some sage developement for the first time, and my code involves 
> creating a Graph from a dictionary (d) I generate. So the code is:
>
> sage: t = Graph(d)
> sage: tree_plot = t.plot(layout='tree', tree_orientation='right', 
> edge_labels=True, tree_root = tree_root)
>
> where tree_root is some instance of a class (I don’t think the class is 
> important for the purpose of this question).
>
> I want to be able to add line objects between specific nodes, just to 
> demonstrate something visually (I do not want to alter the graph), but I'm 
> not sure how to do it. I can add the line to the graph object easily, it's 
> just I'm not sure how to place the line at the specific locations the nodes 
> are at, or if that's even possible. Importantly I would like the end 
> product to still be using the tree_orientation=‘right’setup.
>
> Is this possible?
>
> Thanks [image: :smile:]
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to