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

Undefined variable in is_locally_two_connected #642

Closed flippenc closed 3 years ago

flippenc commented 3 years ago

The is_locally_two_connected function uses a variable f which is not defined in the function. Since is_locally_two_connected is a modification of the 'localised_function' function, f should be the function 'is_two_connected'. One way to fix this is:

def is_locally_two_connected(g):
    """

    ALGORITHM:

    We modify the algorithm from our ``localise`` factory method to stop at
    subgraphs of 2 vertices, since ``is_two_connected`` is undefined on smaller
    subgraphs.
    """
    f = is_two_connected
    return all((f(g.subgraph(g.neighbors(v))) if len(g.neighbors(v)) >= 2
                                              else True) for v in g.vertices())

Or simply:

def is_locally_two_connected(g):
    """

    ALGORITHM:

    We modify the algorithm from our ``localise`` factory method to stop at
    subgraphs of 2 vertices, since ``is_two_connected`` is undefined on smaller
    subgraphs.
    """
    return all((is_two_connected(g.subgraph(g.neighbors(v))) if len(g.neighbors(v)) >= 2
                                              else True) for v in g.vertices())
flippenc commented 3 years ago

I realized that this issue has already been reported.