Skip to content

Implement Gem-Free invariant#458

Merged
fsoupimenta merged 2 commits into
mainfrom
456-checking-for-gem-free-condition
May 13, 2024
Merged

Implement Gem-Free invariant#458
fsoupimenta merged 2 commits into
mainfrom
456-checking-for-gem-free-condition

Conversation

@fsoupimenta

@fsoupimenta fsoupimenta commented May 6, 2024

Copy link
Copy Markdown
Member

Closes #456

Note

In the grinpy library, for free invariants such as Bull-Free, which we already have, there is already a ready-made implementation for checking this condition. However, in the case of Gem-Free, we had to create our own implementation, following the model adopted by grinpy. Here is an example of a method from the library:

def is_bull_free(G):
    # define a bull graph, also known as the graph obtained from the complete graph K_3 by addiing two pendants
    bull = gp.Graph([(0, 1), (0, 2), (1, 2), (1, 3), (2, 4)])

    # enumerate over all possible combinations of 5 vertices contained in G
    for S in set(itertools.combinations(G.nodes(), 5)):
        H = G.subgraph(list(S))
        if gp.is_isomorphic(H, bull):
            return False
    # if the above loop completes, the graph is bull-free
    return True

The same logic was followed, replacing the bull_graph with a gem_graph

@fsoupimenta fsoupimenta requested a review from atilaajones May 6, 2024 06:05
@fsoupimenta fsoupimenta marked this pull request as draft May 6, 2024 08:52
@fsoupimenta fsoupimenta force-pushed the 456-checking-for-gem-free-condition branch from 811305e to 4615371 Compare May 8, 2024 13:39
@fsoupimenta fsoupimenta marked this pull request as ready for review May 8, 2024 13:41
@fsoupimenta fsoupimenta merged commit ccc4ee8 into main May 13, 2024
@fsoupimenta fsoupimenta deleted the 456-checking-for-gem-free-condition branch May 13, 2024 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Checking for gem-free condition

2 participants