Exemple #1
0
def example_hypergraph1():
    # edge set
    edges = {
        'e0': ['v0', 'v1', 'v2'],
        'e1': ['v0', 'v1'],
        'e2': ['v0', 'v2'],
        'e3': ['v0', 'v1', 'v2']
    }
    name = 'hgraph1_simple_n3_m4'  # hypergraph name
    hgraph = {'name': name, 'n': 3, 'm': 4, 'edges': edges}
    helper.ensure_hgraph_dict_complete(hgraph,
                                       ensure_sat_nec_conds=True,
                                       resave=True)
Exemple #2
0
def example_hypergraph4(verbose=True):
    """Hypergraph with 16 distinct SETs (but only 2 distinct SETs up to equivalence)."""
    edges = {
        'e0': ['v0', 'v1'],
        'e1': ['v0', 'v1', 'v2'],
        'e2': ['v0', 'v2'],
        'e3': ['v0', 'v2', 'v3'],
        'e4': ['v0', 'v3']
    }
    hgraph = {'name': 'hgraph4_2eqclass_n4_m5', 'n': 4, 'm': 5, 'edges': edges}
    helper.ensure_hgraph_dict_complete(hgraph,
                                       ensure_sat_nec_conds=True,
                                       resave=True,
                                       verbose=verbose)
def options_test(hgraph_name):
    hgraph = helper.load_hgraph(hgraph_name)
    hgraph = helper.ensure_hgraph_dict_complete(hgraph, True, True)
    print(f"The hypergraph {hgraph_name} has {hgraph['N']} items, of which {hgraph['N1']} are non-secondary and"
          f"{hgraph['Np']} are primary, and {hgraph['M']} options:")
    print(hgraph['options'])
    print()
Exemple #4
0
def example_hypergraph5():
    """Hypergraph corresponding to the unique (up to isomorphism) Steiner Triple System (STS)
    of order 7 (i.e. with 7 points). This STS also corresponds to the Fano plane. The hypergraph
    admits a Spanning Euler Tour.
    Source of the STS: Handbook of Combinatorial Designs by Colbourn and Dinitz"""
    name = 'hgraph5_sts7_n7_m7'
    edges = {
        'e0': ['v0', 'v1', 'v2'],
        'e1': ['v0', 'v3', 'v4'],
        'e2': ['v0', 'v5', 'v6'],
        'e3': ['v1', 'v3', 'v5'],
        'e4': ['v1', 'v4', 'v6'],
        'e5': ['v2', 'v3', 'v6'],
        'e6': ['v2', 'v4', 'v5']
    }
    hgraph = {'name': name, 'n': 7, 'm': 7, 'edges': edges}
    helper.ensure_hgraph_dict_complete(
        hgraph)  # make sure all necessary info is there and save
def domino_test(hgraph_name):
    hgraph = helper.load_hgraph(hgraph_name)
    hgraph = helper.ensure_hgraph_dict_complete(hgraph, True, True)
    print(f"{hgraph['name']} has {hgraph['num_dom']} dominoes:")
    print(hgraph['dominoes'])
    print()