# BFS of Graph

Problem Link: <https://practice.geeksforgeeks.org/problems/bfs-traversal-of-graph/1>

```python
class Solution:
    
    #Function to return Breadth First Traversal of given graph.
    def bfsOfGraph(self, V, adj):
        # code here
        q=[0]
        visited=[0]*(V)
        visited[0]=1
        ans=[]
        while(len(q)>0):
            
            node=q.pop()
            for i in adj[node]:
                if(visited[i]==0):
                    visited[i]=1
                    q.insert(0,i)
                    
            ans.append(node)
        
        return ans
```
