title: graph representation through adjacency lists using STL in c++
body: <p>I am trying to represent a graph through adjacency list in c++. As of now i just want to print the vertices to which a given vertex is attached. I am doing this through vectors and lists. Following is the code</p>
  
  <pre><code>  #include&lt;iostream&gt;
    #include &lt;vector&gt;
    #include &lt;list&gt;
    using namespace std;
    const int N=4;
  
    int main()
    {
      std::vector &lt;std::list&lt;int&gt; &gt; adjList(N);
  
      adjList[0].push_back(1);
  
      adjList[0].push_back(2);
  
      adjList[1].push_back(2);
      adjList[1].push_back(0);
  
      adjList[2].push_back(0);
      adjList[2].push_back(1);
      adjList[2].push_back(3);
  
      adjList[3].push_back(2);
  
      std::vector&lt;std::list&lt;int&gt; &gt;::iterator i;
  
      int c=0;
      for (std::vector&lt;std::list&lt;int&gt; &gt;::iterator i = adjList.begin(); i != adjList.end(); ++i)
      {
        cout&lt;&lt;"vertices connected to node "&lt;&lt; c &lt;&lt;"are";
        std::list&lt;int&gt; li=*i;
        for (std::list&lt;int&gt;::iterator iter=li.begin(); iter!=li.end();++iter)
        {
          cout&lt;&lt;*iter&lt;&lt;" ";
        }
        cout&lt;&lt;endl;
        c++;
      }
      return(0);
    }
  </code></pre>
  
  <p>The code is compiling fine, but is not giving any output. I am using code blocks and GNU GCC, C++ 98 compiler to compile my code.</p>