Ask Your Question
1

set_embedding when the embedding is not unique

asked 2020-11-10 09:19:19 +0200

Ingrid gravatar image

updated 2020-11-10 15:07:24 +0200

FrédéricC gravatar image

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 flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2020-11-10 15:09:54 +0200

FrédéricC gravatar image

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

edit flag offensive delete link more

Comments

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

FrédéricC gravatar imageFrédéricC ( 2020-11-10 15:23:58 +0200 )edit

Thanks. That works now!

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2020-11-10 09:19:19 +0200

Seen: 83 times

Last updated: Nov 10 '20