Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void DFS_visit(int u){
- visited[u] = true; //marks node u as visited
- for(int v = 1; v <= n; v = v+1){ //checks all nodes
- if(visited[v] == false && Adj[u][v] == true) //checks if node v is connected to u and hasn’t been visited yet
- DFS_visit(v); //if yes, calls DFS_visit() for node v
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement