Created
October 31, 2014 13:37
-
-
Save LucasMW/5c372049f45f7969a8a6 to your computer and use it in GitHub Desktop.
GRA_ExisteCaminho . Retorna se existe ou não caminho entre os vértices ditos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GRA_tpCondRet GRA_ExisteCaminho(GRA_tppGrafo grafo, int noInicioId, int noFimId) | |
{ | |
int* ptrIds; | |
int tam; | |
int i; | |
GRA_tpCondRet ret; | |
ret=GRA_DFS(grafo,&ptrIds,&tam,noInicioId); | |
if(ret!=GRA_CondRetOK) | |
return ret; | |
for(i=0;i<tam;i++) | |
{ | |
if(ptrIds[i]==noFimId) | |
return GRA_CondRetCaminhoExiste; | |
} | |
return GRA_CondRetCaminhoNaoExiste; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********************************************************************** | |
* | |
* $FC Função: GRA &ExisteCaminho | |
* | |
* $ED Descrição da função | |
* Esta função verifica se existe caminho entre dois vértices | |
* cujos ids são informados, de um determinado grafo. | |
* | |
* $EP Parâmetros | |
* grafo - ponteiro para a cabeça do grafo a ser impresso | |
* noInicioId - Id do vértice pelo qual se começa | |
* noFimId - Id do vértice ao qual se chega | |
* $FV Valor retornado | |
* Se o caminho for encontrado retornará GRA_CondRetCaminhoExiste | |
* Se o caminho não for encontrado retornará GRA_CondRetCaminhoNaoExiste | |
* Se o grafo for vazio retornará GRA_CondRetGrafoVazio. | |
* Se o vértice inicial não existir retornará GRA_CondRetNoNaoExiste. | |
* | |
* | |
***********************************************************************/ | |
GRA_tpCondRet GRA_ExisteCaminho(GRA_tppGrafo grafo, int noInicioId, int noFimId); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment