Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Algo Tarjan

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for isbkch isbkch
March 05, 2012

Algo Tarjan

Avatar for isbkch

isbkch

March 05, 2012
Tweet

Other Decks in Education

Transcript

  1. Algorithme de Tarjan Master d’Informatique — UPMC STL – M1.

    UE Algorithmique avanc´ ee Ann´ ee 2007 — 2008 1 Algorithme de Tarjan Initialisations P=pile vide ; n=0 ; k=0 Pour chaque sommet s Faire pref[s]=0 ; ret[s]=0 ; dansPile[s]=Faux ; comp[s]=0 Fin Pour Calcul de toutes les composantes fortement connexes Pour chaque sommet s Faire Si pref[s]=0 Alors CFC(s) Fin Si Fin Pour Calcul de la composante fortement connexe d’un sommet Procedure CFC(x:sommet) empiler(x,P) ; dansPile[x]=Vrai n=n+1; pref[x]=n ; m=pref[x] Pour chaque successeur y de x Faire Si pref[y]=0 Alors CFC(y) m=min(pref[x],ret[y]) Sinon Si dansPile[y] Alors m=min(m,pref[y]) Fin Si Fin Si Fin Pour ret[x]=m Si ret[x]=pref[x] Alors k=k+1 Repeter y=sommetPile[P] ; depiler(P) ; dansPile[y]=Faux comp[y]=k Jusque y=x Fin Si Fin Procedure 1
  2. 2 Exemples Appliquer l’algorithme de Tarjan aux graphes orient´ es

    suivants : 1) 1 3 2 4 2) 1 3 2 4 3) 1 3 2 4 4) 1 3 2 4 5) 7 8 1 2 6 5 4 3 6) 7 8 1 2 6 5 4 3 2