Ticket #7734: trac_7734.patch

File trac_7734.patch, 1.0 KB (added by ncohen, 11 years ago)
  • sage/graphs/graph_coloring.py

    # HG changeset patch
    # User Nathann Cohen <nathann.cohen@gmail.com>
    # Date 1261126927 -3600
    # Node ID 3f96f2bfbde9ebca40ed917bf4ea04bf4ccdf386
    # Parent  964c2f4ce74db0417a771de0b0cfc951b1fab73c
    small bug : infinite loop in edge_coloring when no solver was installed
    
    diff -r 964c2f4ce74d -r 3f96f2bfbde9 sage/graphs/graph_coloring.py
    a b  
    513513    """
    514514    from sage.numerical.mip import MixedIntegerLinearProgram
    515515    from sage.plot.colors import rainbow
     516    from sage.numerical.mip import MIPSolverException
    516517
    517518    if g.is_clique():
    518519        if value_only:
     
    551552    e = g.edge_iterator().next()
    552553    p.set_objective(color[R(e)][0])
    553554    p.set_binary(color)
     555
    554556    try:
    555557        if value_only:
    556558            p.solve(objective_only=True, log=log)
    557559        else:
    558560            chi = p.solve(log=log)
    559     except:
     561    except MIPSolverException:
    560562        if value_only:
    561563            return k + 1
    562564        else: