Question: This Following C Program is in DFS Form. #include void dfs(int g[100][100], int visited[], int source, int n); int main() { int vertex,i,j; printf(enter number

This Following C Program is in DFS Form.

#include

void dfs(int g[100][100], int visited[], int source, int n);

int main() { int vertex,i,j;

printf("enter number of vertex:"); scanf("%d", &vertex); int arr[100][100], visited[100];

for (i=0; i

}

printf("graph values: ");

for(i=0; i

dfs(arr, visited, 3, vertex); return 0; }

void dfs(int g[][100], int visited[], int source, int n)//n: number of vertices, k: node { int i; visited[source] = 1; printf("%c visited ",65+source); for(i = 0; i< n; i++) { if(g[source][i] == 1 && visited[i] == 0) dfs(g, visited, i, n); } }

You have to implement BFS in the C program.

N.B. : Not a new code you have to edit the given code and implement to BFS.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!