Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <queue>
- #include <iostream>
- using namespace std;
- #define N 100
- int mas[N][N];
- int used[N] = { 0 };
- int n;
- void bfs(int v) {
- queue<int> q;
- q.push(v);
- used[v] = 1;
- while () {
- for (int i = 1; i <= n; i++) {
- if (used[i] == 0 && mas[v][i] == 1) {
- q.push(i);
- used[i] = 1;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment