SlideShare une entreprise Scribd logo
1  sur  2
But : Déterminisme de Temps d’exécution d’un algorithme heuristique (DFS)
Nomet prénom Wael Toumi
Spécialité Big Data & Analyse desdonnées
Le nœud de départ est « A »
Pseudo code DFS avec python :
fromtime importtime
graph = { 'a': {'d', 'h','g','b','c'},
'c': {'h', 'd'},
'd': {'e', 'b'},
'h': {'g'},
'g': {'b','f'},
'b':{'e','f'},
'f': {'e'},
'e':{}
}
t0=time();
def dfs(graph,depart):
pile=[]
nv=[]
pile.append(depart)
while pile:
But : Déterminisme de Temps d’exécution d’un algorithme heuristique (DFS)
noeud=pile[-1]
pile.pop()
if noeudnotinnv:
nv.append(noeud)
fori in graph[noeud]:
if i not innv:
pile.append(i)
print(nv)
dfs(graph,'a')
t1=time();
print("le tempsd'exécutionde DFSprend",round((t1-t0)*1000,0), 'ms')

Contenu connexe

Tendances

ForumPHP 2018 : Comprendre le Machine Learning quand on n’y connaît rien
ForumPHP 2018 : Comprendre le Machine Learning quand on n’y connaît rienForumPHP 2018 : Comprendre le Machine Learning quand on n’y connaît rien
ForumPHP 2018 : Comprendre le Machine Learning quand on n’y connaît rienFrederic Bouchery
 
1 entropie-capacite theorie de l'information
1 entropie-capacite theorie de l'information1 entropie-capacite theorie de l'information
1 entropie-capacite theorie de l'informationAbdou Obado
 
Puissances
PuissancesPuissances
Puissanceszeinabze
 
12 quelques prédicats prédéfinis de swi
12  quelques prédicats prédéfinis de swi12  quelques prédicats prédéfinis de swi
12 quelques prédicats prédéfinis de swiSiham Rim Boudaoud
 
2- The iTronics Internet of things Workshop 27-05-2017 - GPIO
2- The iTronics Internet of things Workshop 27-05-2017 - GPIO2- The iTronics Internet of things Workshop 27-05-2017 - GPIO
2- The iTronics Internet of things Workshop 27-05-2017 - GPIORomaric Saounde Tsopnang
 
The iTronics Internet of things Workshop 27-05-2017 - get started
The iTronics Internet of things Workshop 27-05-2017 - get startedThe iTronics Internet of things Workshop 27-05-2017 - get started
The iTronics Internet of things Workshop 27-05-2017 - get startedRomaric Saounde Tsopnang
 
Correction TP3.docx
Correction TP3.docxCorrection TP3.docx
Correction TP3.docxBnsrania
 
Affiches eleve
Affiches eleveAffiches eleve
Affiches eleveOTANGAD
 
Résumé Algorithme et Programmation
Résumé Algorithme et ProgrammationRésumé Algorithme et Programmation
Résumé Algorithme et Programmationborhen boukthir
 
Chiffrement affine et césar par Zellagui Amine
Chiffrement affine et césar par Zellagui AmineChiffrement affine et césar par Zellagui Amine
Chiffrement affine et césar par Zellagui AmineZellagui Amine
 

Tendances (19)

Google Developer Group (GDG) Aix-Marseille #1 (27/08/2018)
Google Developer Group (GDG) Aix-Marseille #1 (27/08/2018)Google Developer Group (GDG) Aix-Marseille #1 (27/08/2018)
Google Developer Group (GDG) Aix-Marseille #1 (27/08/2018)
 
ForumPHP 2018 : Comprendre le Machine Learning quand on n’y connaît rien
ForumPHP 2018 : Comprendre le Machine Learning quand on n’y connaît rienForumPHP 2018 : Comprendre le Machine Learning quand on n’y connaît rien
ForumPHP 2018 : Comprendre le Machine Learning quand on n’y connaît rien
 
1 entropie-capacite theorie de l'information
1 entropie-capacite theorie de l'information1 entropie-capacite theorie de l'information
1 entropie-capacite theorie de l'information
 
Puissances
PuissancesPuissances
Puissances
 
Rapport tp RSA
Rapport  tp  RSARapport  tp  RSA
Rapport tp RSA
 
Ch07 15
Ch07 15Ch07 15
Ch07 15
 
12 quelques prédicats prédéfinis de swi
12  quelques prédicats prédéfinis de swi12  quelques prédicats prédéfinis de swi
12 quelques prédicats prédéfinis de swi
 
2- The iTronics Internet of things Workshop 27-05-2017 - GPIO
2- The iTronics Internet of things Workshop 27-05-2017 - GPIO2- The iTronics Internet of things Workshop 27-05-2017 - GPIO
2- The iTronics Internet of things Workshop 27-05-2017 - GPIO
 
Ch33 14
Ch33 14Ch33 14
Ch33 14
 
The iTronics Internet of things Workshop 27-05-2017 - get started
The iTronics Internet of things Workshop 27-05-2017 - get startedThe iTronics Internet of things Workshop 27-05-2017 - get started
The iTronics Internet of things Workshop 27-05-2017 - get started
 
Correction TP3.docx
Correction TP3.docxCorrection TP3.docx
Correction TP3.docx
 
13s17 z83iw
13s17 z83iw13s17 z83iw
13s17 z83iw
 
Exercice primitives
Exercice primitivesExercice primitives
Exercice primitives
 
Ch05 23
Ch05 23Ch05 23
Ch05 23
 
Affiches eleve
Affiches eleveAffiches eleve
Affiches eleve
 
Dérivation et primitivation
Dérivation et primitivationDérivation et primitivation
Dérivation et primitivation
 
Résumé Algorithme et Programmation
Résumé Algorithme et ProgrammationRésumé Algorithme et Programmation
Résumé Algorithme et Programmation
 
Chiffrement affine et césar par Zellagui Amine
Chiffrement affine et césar par Zellagui AmineChiffrement affine et césar par Zellagui Amine
Chiffrement affine et césar par Zellagui Amine
 
Correction td2
Correction td2Correction td2
Correction td2
 

Pseudo code DFS (Temps d'exécution avec python)

  • 1. But : Déterminisme de Temps d’exécution d’un algorithme heuristique (DFS) Nomet prénom Wael Toumi Spécialité Big Data & Analyse desdonnées Le nœud de départ est « A » Pseudo code DFS avec python : fromtime importtime graph = { 'a': {'d', 'h','g','b','c'}, 'c': {'h', 'd'}, 'd': {'e', 'b'}, 'h': {'g'}, 'g': {'b','f'}, 'b':{'e','f'}, 'f': {'e'}, 'e':{} } t0=time(); def dfs(graph,depart): pile=[] nv=[] pile.append(depart) while pile:
  • 2. But : Déterminisme de Temps d’exécution d’un algorithme heuristique (DFS) noeud=pile[-1] pile.pop() if noeudnotinnv: nv.append(noeud) fori in graph[noeud]: if i not innv: pile.append(i) print(nv) dfs(graph,'a') t1=time(); print("le tempsd'exécutionde DFSprend",round((t1-t0)*1000,0), 'ms')