math1um / objects-invariants-properties

Objects, Invariants and Properties for Graph Theory (GT) automated conjecturing: in particular with the Sage program CONJECTURING: http://nvcleemp.github.io/conjecturing/
GNU General Public License v3.0
15 stars 6 forks source link

Lovasz_theta is broken for many graphs - temporary fix #639

Open math1um opened 3 years ago

math1um commented 3 years ago

THIS IS A MAJOR PROBLEM

due to the built-in .lovasz_theta() Graph method

NEEDS TO BE INVESTIGATED

TEMPORARY FIX - rewrite lovasz_theta so it returns None when .lovasz_theta() method crashes

def lovasz_theta(g, epsilon = 0.00001):
    '''
    Return the Lovesz theta number of a graph g.

    Sage has a built-in invariant but during numerical calculation, the lovasz theta number does not always return the expected value

    The value of lovasz theta is a real number and thus admits the potential of numerical error in its computation. This hack introduces a different potential source of error in cases where the value is very close to an integer but not actually equal to that integer. The tradeoff is that it solves the problem of a conjecture like alpha<=theta to be counted as false when alpha=theta=7 but the computed value of theta is 6.99999. Pros and cons, as is always the case in life!

    as of 21.7.19 .lovasz_theta() Graph method is broken (crashes for many graphs). This needs to be investigated. This hack returns None for broken graphs and is NOT a fix.
    INPUT:

    -``g``-- Sage Graph

    OUTPUT:

    -Integer
    '''
    try:        
        initial = g.lovasz_theta()
        if abs(initial - round(initial)) < epsilon:
            return round(initial)
    except:
        return None
add_to_lists(lovasz_theta, efficient_invariants, all_invariants)