Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hmmmmm.. Well it seems that obtaining the embedding from the positions is notimplemented yet (and it should not be complicated, so you are welcome to add it if you need it !), but you can obtain an embedding from a call to is_planar. This will give you a planar embedding, though it will use its own layout for the vertices of your graph.

{{{ sage: g=graphs.IcosahedralGraph() sage: g.get_embedding() ... ValueError: Icosahedron has been modified and the embedding is no longer valid sage: g.is_planar(set_embedding=True) True sage: g.get_embedding()
{0: [1, 5, 11, 7, 8], 1: [8, 2, 6, 5, 0], 2: [8, 9, 3, 6, 1], 3: [2, 9, 10, 4, 6], 4: [3, 10, 11, 5, 6], 5: [0, 1, 6, 4, 11], 6: [1, 2, 3, 4, 5], 7: [0, 11, 10, 9, 8], 8: [0, 7, 9, 2, 1], 9: [8, 7, 10, 3, 2], 10: [9, 7, 11, 4, 3], 11: [0, 5, 4, 10, 7]} }}}

Hmmmmm.. Well it seems that obtaining the embedding from the positions is notimplemented yet (and it should not be complicated, so you are welcome to add it if you need it !), but you can obtain an embedding from a call to is_planar. This will give you a planar embedding, though it will use its own layout for the vertices of your graph.

{{{

sage: g=graphs.IcosahedralGraph()
sage: g.get_embedding()
...
ValueError: Icosahedron has been modified and the embedding is no longer valid
sage: g.is_planar(set_embedding=True)
True
sage: g.get_embedding() 
g.get_embedding() {0: [1, 5, 11, 7, 8], 1: [8, 2, 6, 5, 0], 2: [8, 9, 3, 6, 1], 3: [2, 9, 10, 4, 6], 4: [3, 10, 11, 5, 6], 5: [0, 1, 6, 4, 11], 6: [1, 2, 3, 4, 5], 7: [0, 11, 10, 9, 8], 8: [0, 7, 9, 2, 1], 9: [8, 7, 10, 3, 2], 10: [9, 7, 11, 4, 3], 11: [0, 5, 4, 10, 7]} }}}