Adjacent list self referencing to Graph object
<p>i am trying to implement an adjacent list for a graph class in C++. At the moment I want to write a method which will update the adjacent list of the Graph node and every adjacent node. Could you tell me what is wrong with this snippet of code? When I am executing my program the adjacent nodes still don't have the node calling update_adjacent in their adjacent list.
Thank you in advance.</p>

<pre><code>void Graph::update_adjacent(list&lt;Graph&gt;l) {
for (list&lt;Graph&gt;::iterator iterator = l.begin(), end = l.end(); iterator != end; ++iterator) {
    adj_list.push_back(*iterator);
    (*iterator).adj_list.push_back(*this);
}}
</code></pre>