# set_embedding when the embedding is not unique

My planar graphs are not uniquely embeddable. The embedding found by sage is not the one I want, and I'm having trouble setting another one.

 sage: D3half2=Graph({0:{1:'x2', 2:'x8', 3:'x9', 4:'x5'}, 1:{2:'x3'}, 2:{3:'x6', 4:'x4'}, 3:{4:'x12', 5:'x10'}, 4:{5:'x11'}})
sage: D3half2.is_planar(set_embedding=True)
sage: D3half2.set_embedding({0:{1, 4, 3, 2}, 1:{2, 0}, 2:{1, 0, 3, 4}, 3:{2, 0, 4, 5}, 4:{2, 5, 3, 0}})
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-11-78d1277ebcd7> in <module>()
----> 1 D3half2.set_embedding({Integer(0):{Integer(1), Integer(4), Integer(3), Integer(2)}, Integer(1):{Integer(2), Integer(0)}, Integer(2):{Integer(1), Integer(0), Integer(3), Integer(4)}, Integer(3):{Integer(2), Integer(0), Integer(4), Integer(5)}, Integer(4):{Integer(2), Integer(5), Integer(3), Integer(0)}})

/opt/sagemath-9.1/local/lib/python3.7/site-packages/sage/graphs/generic_graph.py in set_embedding(self, embedding)
2501             ValueError: vertices in ['s'] from the embedding do not belong to the graph
2502         """
-> 2503         self._check_embedding_validity(embedding, boolean=False)
2504         self._embedding = embedding
2505

/opt/sagemath-9.1/local/lib/python3.7/site-packages/sage/graphs/generic_graph.py in _check_embedding_validity(self, embedding, boolean)
2589                 raise ValueError("vertices in {} from the embedding do not belong to the graph".format(list(set(embedding).difference(self))))
2590             else:
-> 2591                 raise ValueError("vertices in {} have no corresponding entry in the embedding".format(list(set(self).difference(embedding))))
2592
2593         if self._directed:

ValueError: vertices in [5] have no corresponding entry in the embedding


Thanks for any help!!!

edit retag close merge delete

Sort by » oldest newest most voted

you should not give one set for every vertex, but one list for every vertex, using the local orientation around the vertex and cutting somewhere

more

and you are not providing the embedding data around the vertex 5

( 2020-11-10 15:23:58 +0200 )edit

Thanks. That works now!

( 2020-11-11 02:56:22 +0200 )edit

## Stats

Seen: 82 times

Last updated: Nov 10 '20