#12389: Bug in graph coloring
----------------------------+-----------------------------------------------
   Reporter:  ncohen        |          Owner:  jason, ncohen, rlm
       Type:  defect        |         Status:  new               
   Priority:  major         |      Milestone:  sage-5.0          
  Component:  graph theory  |       Keywords:                    
Work_issues:                |       Upstream:  N/A               
   Reviewer:                |         Author:  Nathann Cohen     
     Merged:                |   Dependencies:                    
----------------------------+-----------------------------------------------
 Geoff Tims reported the following bug :

 {{{
 sage: sub = graphs.PetersenGraph()
 sage: sub.complement().chromatic_number(algorithm="MILP")
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)

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

 /home/ncohen/.Sage/local/lib/python2.7/site-packages/sage/graphs/graph.pyc
 in chromatic_number(self, algorithm)
    2487         elif algorithm == "MILP":
    2488             from sage.graphs.graph_coloring import vertex_coloring
 -> 2489             return vertex_coloring(self, value_only=True)
    2490         # another algorithm with bad performance; only good for
 small graphs
    2491         elif algorithm == "CP":

 /home/ncohen/.Sage/local/lib/python2.7/site-
 packages/sage/graphs/graph_coloring.pyc in vertex_coloring(g, k,
 value_only, hex_colors, solver, verbose)
     342             # tries to color the graph, increasing k each time it
 fails.
     343             tmp = vertex_coloring(g, k=k, value_only=value_only,
 --> 344                                   hex_colors=hex_colors,
 verbose=verbose)
     345             if tmp is not False:
     346                 if value_only:

 /home/ncohen/.Sage/local/lib/python2.7/site-
 packages/sage/graphs/graph_coloring.pyc in vertex_coloring(g, k,
 value_only, hex_colors, solver, verbose)
     431         # a vertex has exactly one color
     432         [p.add_constraint(Sum([color[v][i] for i in xrange(k)]),
 min=1, max=1)
 --> 433              for v in g.vertices()]
     434         # adjacent vertices have different colors
     435         [p.add_constraint(color[u][i] + color[v][i], max=1)

 TypeError: integer argument expected, got float
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12389>
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