Skip to content

Commit

Permalink
Trac #19193: is_planar() fails with an immutable graph
Browse files Browse the repository at this point in the history
{{{
sage: Posets.ChainPoset(2).cover_relations_graph().is_planar()
True
sage: Posets.BooleanLattice(3).cover_relations_graph().is_planar()
 . . . ValueError: To relabel an immutable graph use inplace=False
}}}

URL: http://trac.sagemath.org/19193
Reported by: jmantysalo
Ticket author(s): Jori Mäntysalo
Reviewer(s): Nathann Cohen
  • Loading branch information
Release Manager authored and vbraun committed Sep 18, 2015
2 parents 49350d6 + 24280ff commit a9354cf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/sage/graphs/generic_graph.py
Expand Up @@ -3970,7 +3970,7 @@ def is_planar(self, on_embedding=None, kuratowski=False, set_embedding=False, se

.. NOTE::

the argument on_embedding takes precedence over
The argument on_embedding takes precedence over
``set_embedding``. This means that only the ``on_embedding``
combinatorial embedding will be tested for planarity and no
``_embedding`` attribute will be set as a result of this function
Expand Down Expand Up @@ -4091,6 +4091,11 @@ def is_planar(self, on_embedding=None, kuratowski=False, set_embedding=False, se
sage: emb = {0 : [2,3,1], 1: [2,3,0], 2: [1,3,0], 3:[0,1,2]}
sage: g.is_planar(on_embedding=emb)
False

:trac:`19193`::

sage: Posets.BooleanLattice(3).cover_relations_graph().is_planar()
True
"""
if self.has_multiple_edges() or self.has_loops():
if set_embedding or (on_embedding is not None) or set_pos:
Expand All @@ -4104,6 +4109,8 @@ def is_planar(self, on_embedding=None, kuratowski=False, set_embedding=False, se
else:
from sage.graphs.planarity import is_planar
G = self.to_undirected()
if hasattr(G, '_immutable'):
G = copy(G)
planar = is_planar(G,kuratowski=kuratowski,set_pos=set_pos,set_embedding=set_embedding)
if kuratowski:
bool_result = planar[0]
Expand Down

0 comments on commit a9354cf

Please sign in to comment.