#10139: Problem found in graphs.is_planar() when the graph has no edges.
----------------------------------+-----------------------------------------
   Reporter:  edward.scheinerman  |       Owner:  tbd
       Type:  defect              |      Status:  new
   Priority:  major               |   Milestone:     
  Component:  PLEASE CHANGE       |    Keywords:     
     Author:                      |    Upstream:  N/A
   Reviewer:                      |      Merged:     
Work_issues:                      |  
----------------------------------+-----------------------------------------
 The is_planar method for graphs includes a set_embedding argument that
 saves the combinatorial embedding of the graph (if it's planar). In this
 example, it works properly:

 sage: g = graphs.WheelGraph(6)
 sage: g.is_planar(set_embedding=True)
 True
 sage: g.get_embedding()
 {0: [1, 5, 4, 3, 2], 1: [2, 5, 0], 2: [0, 3, 1], 3: [0, 4, 2], 4: [0, 5,
 3], 5: [0, 1, 4]}

 However, is we apply this method to a graph with no edges, a problem
 arises:

 sage: g = graphs.EmptyGraph()
 sage: g.add_vertices(range(6))
 sage: g.is_planar(set_embedding=True)
 ---------------------------------------------------------------------------
 AttributeError                            Traceback (most recent call
 last)

 /home/ers/<ipython console> in <module>()

 /usr/public/share/sage/local/lib/python2.6/site-
 packages/sage/graphs/generic_graph.pyc in is_planar(self, on_embedding,
 kuratowski, set_embedding, set_pos)
    2438                     self._pos = G._pos
    2439                 if set_embedding:
 -> 2440                     self._embedding = G._embedding
    2441             return planar
    2442

 AttributeError: 'Graph' object has no attribute '_embedding'

 Once we add an edge to this graph, all is well:

 sage: g.add_edge(0,1)
 sage: sage: g.is_planar(set_embedding=True)
 True
 sage: g.get_embedding()
 {0: [1], 1: [0], 2: [], 3: [], 4: [], 5: []}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10139>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to