C++ || BFS || Graph || Commented & clean code
\n // Intuition  -> we have to make all the edges going towards 0\n    \n    // so we will start from 0 , all  the nodes which are going away from\n    // 0 , w
```\n // Intuition  -> we have to make all the edges going towards 0\n    \n    // so we will start from 0 , all  the nodes which are going away from\n    // 0 , we will take into count \n    \n    // Now the thing is , there is mixup of the all the edges , is it \n    // sure that we will reach every nodes edge in that way \n    \n    // What extra we have to do we have to also make reversed edges \n    // & we have to iterate the curr_edges of node & also reversed edges\n    // of that node , & if not visited then push in the the queue\n    \n    // Lets code this BFS \n    int minReorder(int n, vector<vector<int>>& edges) {\n        \n        vector<int> adj[n];\n        vector<int> back_adj[n];\n        \n        for(int i=0;i<edges.size();i++)\n        {\n            int u=edges[i][0];\n            int v=edges[i][1];\n            \n            adj[u].push_back(v);\n            back_adj[v].push_back(u);\n        }\n        \n        queue< int> q;\n        q.push(0);\n        \n        vector<bool> visited(n , false);\n        visited[0]=true;\n        \n        int ans=0;\n        \n        while(!q.empty())\n        {\n            int node=q.front();\n            q.pop();\n            \n            // traverse all the nodes which are going away\n            // from 0 \n            \n            for(auto x : adj[node])\n            {\n                if(visited[x]==false)\n                {\n                    q.push(x);\n                    visited[x]=true;\n                    ans++;\n                }\n            }\n            \n            // Now which are not reachable , reached to it \n            // means they are in directional edges , means towards 0\n            // but we have to visit it , as it may occurs some edges\n            // which are away from 0 , so for that we have to visit \n            \n            // all the nodes\n            \n            for(auto x : back_adj[node])\n            {\n                if(visited[x]==false)\n                {\n                    q.push(x);\n                    visited[x]=true;\n                    \n                }\n            }\n        }\n        \n        return ans;\n        \n        \n    }\n```
['Breadth-First Search', 'Graph', 'C', 'C++']