Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword or section
Like this
12Activity
0 of .
Results for:
No results containing your search query
P. 1
grafos

grafos

Ratings:

4.33

(1)
|Views: 2,232|Likes:
Published by shabedekam

More info:

Published by: shabedekam on May 16, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

07/24/2013

pdf

text

original

 
Numerar v
é
rtices DFS
acci
ó
n
NUMERAR_VERTICES
( g es grafo )
{
 Pre
: g es un grafo dirigido }
Para cada v
V hacerg:= Marcar( g, v, 'no_visto' )v.num-dfs := 0;v.num-invdfs := 0;fparandfs := 0; ninv := 0 ;Para cada v
V hacerSi
¬
Visto( g, v ) entonces
NV-1
( g, v, ndfs, ninv );fparafacci
ó
n
acci
ó
n
NV-1
( g es grafo; u es v
é
rtice;nd, ni es nat )
nd:= nd+1; u.num-dfs := nd;g:= Marcar( g, v, 'visto' )Para cada w
succ(g,u) hacer
 
Si
¬
Visto( g, w ) entonces
NV-1
( g, w, nd, ni)fparani := ni+1; u.num-invdfs := ni;ffunci
ó
n
 
Numerar v
é
rtices DFS – (Iterativo)
acci
ó
n
NUMERAR_VERTICES
( g es grafo )
{
 Pre
: g es un grafo dirigido }
p:= pvacia;ndfs := 0;Para cada v
V hacerg:= Marcar( g, v, 'no_visto' )v.num-dfs := 0;p:= apilar(p, v);fparaMientras
¬
vacia(p) haceru:=cima(p); p:=desapilar(p);Si
¬
Visto( g, u ) entoncesg:= Marcar( g, u, 'visto' )ndfs:= ndfs+1;u.num-dfs := ndfs;Para cada w
succ(g,u) hacerSi
¬
Visto( g, w ) entoncesp:=apilar(p, w);fparafmientras

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->