graph-theoryhamiltonian-cycle

Draw a 7 vertex simple graph with exactly 1800 hamiltonian paths


I came across this question while preparing for an exam on my course in 'Introduction to Graph Theory'. I would greatly appreciate if someone gives the methodology to approach such a question (where you specify the number of vertices and Hamiltonian or Euclidean paths and ask the structure of the graph).


Solution

  • It seems there is no 7 vertex graph with that property. At least I didn't find it :-)

    In complete 7 vertex graph (K_7) there are 7! paths (same as numer of permutations: 5040.) Removing one edge from K_7 produces 5*6! paths (3600).

    Removing of one edge in almost complete graph removes lot of paths. Because of that to produce exactly 1800 paths at most 3 edges can be removed. Here is a python script that checks number of paths without one, two, and three edges.

    without_edges = (
        # One edge
        ('01',),
        # Two edges
        ('01', '23'),
        ('01', '12'),
        # Three edges
        ('01', '23', '45'),
        ('01', '02', '34'),
        ('01', '02', '23'),
        ('01', '02', '03'),
        # Four edges, few for testing
        ('01', '23', '45', '06'),
        ('01', '23', '45', '02'),
        ('01', '02', '34', '56'),
        ('01', '02', '34', '45'),
        ('01', '02', '34', '05'),
        # ...
    )
    
    for w_edges in without_edges:
        w_e = w_edges + tuple(e[::-1] for e in w_edges)
        n = 0
        for p in permutations('0123456'):
            p = ''.join(p)  # Represent permutation as a string
            if all(e not in p for e in w_e):
                n += 1
        print n, w_edges
    

    Output is:

    3600 ('01',)
    2640 ('01', '23')
    2400 ('01', '12')
    1968 ('01', '23', '45')
    1824 ('01', '02', '34')
    1632 ('01', '02', '23')
    1440 ('01', '02', '03')
    1392 ('01', '23', '45', '06')
    1272 ('01', '23', '45', '02')
    1392 ('01', '02', '34', '56')
    1320 ('01', '02', '34', '45')
    1152 ('01', '02', '34', '05')
    

    There is no graph with exactly 1800 path, except direction of path is not important than K_7 minus one edge has 1800 paths.