This documentation is automatically generated by online-judge-tools/verification-helper
View the Project on GitHub kisepichu/library
#include "lib/graph/bfs.hpp"
#pragma once template<class veFi, class vFe > void bfs(int n, int s, veFi g, vFe dtmn){ vector<int>vis(n); vis[s] = 1; queue<int>q({ s }); while(q.size()){ int c = q.front(); q.pop(); for(auto e: g(c))if(!vis[e.to])vis[e.to] = 1, dtmn(e), q.push(e.to); } } /* * @title BFS */
#line 2 "lib/graph/bfs.hpp" template<class veFi, class vFe > void bfs(int n, int s, veFi g, vFe dtmn){ vector<int>vis(n); vis[s] = 1; queue<int>q({ s }); while(q.size()){ int c = q.front(); q.pop(); for(auto e: g(c))if(!vis[e.to])vis[e.to] = 1, dtmn(e), q.push(e.to); } } /* * @title BFS */