Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I am also having trouble with set_embedding. My Graph does not have a unique planar embedding, and I would like to set the embedding to a different one from that found by sage.

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()

True

sage:D3half2.is_planar(set_embedding=True) 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!!!!