Jump to content

[Resolvido] Breadth First Search - Grafos


Recommended Posts

Posted (edited)

Boas pessoal estou com umas duvidas a implementar uma função que faça uma procura "breadth first" num grafo.

Actualmente tenho isto:

Null

So consegui fazer uma bocado. Alguém pode-me dar uma ajuda?

Edited by esfomeado
Posted (edited)

Alterei o codigo e corrigi isso.

Não sei é se estou a fazer bem isto:

  	 for(int i=0; i<w; i++)
       {
           if(visit.hasInfo(*S.find(i))==0)
           {
               key = get(*S.find(i));
               Q.enqueue(key);
           }
       }

hasinfo retorna o numero de vezes que foi encontrada a chave

a funcao find devolve um apontador para o valor encontrado.

Edited by esfomeado

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.