图遍历算法实现



  1.  

01.#include"head.h"   
02.int visited[MAXV];  
03.  
04.int main()  
05.{  
06.    ALGraph *G;  
07.    int A[5][5]=  
08.    {  
09.        {0,1,0,1,0},  
10.        {1,0,1,0,0},  
11.        {0,1,0,1,1},  
12.        {1,0,1,0,1},  
13.        {0,0,1,1,0}  
14.    };  
15.    ArrayToList(A[0], 5, G);  
16.  
17.    printf(" 由2开始广度遍历:");  
18.    BFS(G, 2);  
19.  
20.    printf(" 由0开始广度遍历:");  
21.    BFS(G, 0);  
22.    return 0;  
23.}  




 

  •  

     

  • 你可能感兴趣的:(图遍历算法实现)