title: Can there be any improvements in DFS traversal of graph code posted below?
body: <p>I want to improve efficiency of this DFS traversal code.</p>
  
  <p>I intend to create a standard code for my self so that I can use it for online Competitive coding contests without any need to write whole thing again but just making few modifications in this code.</p>
  
  <pre><code>    #include &lt;iostream&gt;
      #include&lt;vector&gt;
      using namespace std;
      void print_graph(const vector&lt;vector &lt;int&gt; &gt;GRAPH);
      void set_graph( vector&lt;vector &lt;int&gt; &gt;&amp;GRAPH,const unsigned int sz);
      void DFS_Util(const vector&lt;vector &lt;int&gt; &gt;GRAPH,bool visted[]);
      void DFS(const vector&lt;vector &lt;int&gt; &gt;GRAPH,const unsigned int V);
      int main()
      {
      vector&lt;vector &lt;int &gt; &gt;GRAPH;
      int vertices;
      cin&gt;&gt;vertices;
  
        for(int i=0;i&lt;vertices;i++)
          {   vector&lt;int&gt;temp(vertices,0);
            GRAPH.push_back(temp);
          }
      set_graph(GRAPH,GRAPH.size());
  
      print_graph(GRAPH);
      DFS(GRAPH,0);
  
          return 0;
      }
  
      void print_graph(const vector&lt;vector &lt;int&gt; &gt;GRAPH)
      {   int sz=GRAPH.size();
      for(int i=0;i&lt;sz;i++)
          {
              for(int j=0;j&lt;sz;j++)
          {
            cout&lt;&lt;GRAPH[i][j]&lt;&lt;" ";
          }cout&lt;&lt;endl;
          }
      }
      void set_graph( vector&lt;vector &lt;int&gt; &gt;&amp;GRAPH,const unsigned int sz)
      {
       for(unsigned int i=0;i&lt;sz;i++)
          {
              for(unsigned int j=0;j&lt;sz;j++)
          {
              int c;
              cin&gt;&gt;c;
      GRAPH.at(i).at(j)=c;
          }
          }
      }
  
      void DFS_Util(const vector&lt;vector &lt;int&gt; &gt;GRAPH,const unsigned int v,bool visted[])
      {
      visted[v]=true;
      cout&lt;&lt;" "&lt;&lt;v;
  
      for(unsigned int j=0;j&lt;GRAPH.size();j++)
      {
       if(!visted[j]&amp;&amp;GRAPH[v][j]&gt;=1)
         DFS_Util(GRAPH,j,visted);
      }
  
      }
      void DFS(const vector&lt;vector &lt;int&gt; &gt;GRAPH,const unsigned int V)
      {
          bool *visited=new bool[GRAPH.size()];
          for(unsigned int i=0;i&lt;GRAPH.size();i++)
          {
              visited[i]=false;
          }
  
          DFS_Util(GRAPH,V,visited);
  
      }
  </code></pre>