Example #1
0
def display_labyrinth_graph_analysis():
    '''
    Displays the analysis of the Labyrinth of Theseus
    as a graph in the console.
    '''
    begin = time.time()
    print('Building graph ...')
    graph = GraphAnalysis.import_graph()
    print('Done!')
    # All acyclic paths from the entry to the exit of the labyrinth
    print('Analysing graph ...')
    acyclic_paths = GraphAnalysis.all_acyclic_paths(graph, '0a', '37a')
    cyclic_paths = GraphAnalysis.all_distinct_cycles(graph)
    print('Done!')
    end = time.time()
    print(f'Time passed: {end - begin: .2f} seconds')
    print(f'''
----------Labyrinth of Theseus graph analysis----------

Node count : {graph.node_count()}
Edge count : {graph.edge_count()}

-----------Acyclic paths from entry to exit------------
{written_paths_analysis(acyclic_paths)}
-------------------Distinct cycles---------------------
{written_paths_analysis(cyclic_paths)}
''')