Skip to content
Snippets Groups Projects
Select Git revision
  • 550d435a2008fc0eef83cb0d30fdb53c32de264f
  • master default protected
2 results

graphe-dico.py

Blame
  • Forked from Vuillemot Romain / INF-TC1
    Source project has a limited visibility.
    graphe-dico.py 415 B
    G = {
        'A' : ['B','C', 'F'],
        'B' : ['D', 'E'],
        'C' : ['F'],
        'D' : ['G'],
        'E' : ['F'],
        'F' : ['G', 'H'],
        'G' : ['H'],
        'H' : []
    }
    
    v = set()
    
    def traitement(v, G, n):
        if n not in v:
            v.add(n)
            print(n)
            for m in G[n]:
                traitement(v, G, m)
    
    if __name__ == '__main__':
        traitement(v, G, 'A')
    
        if len(v) > 0:
            print("Que se passe-t-il ?")