title: #include/scope issues with graph implementation
body: <p>graph.h:</p>
  
  <pre><code> #include&lt;vector&gt;
   #include&lt;unordered_map&gt;
   #include&lt;iostream&gt;
   #include&lt;queue&gt;
   #include&lt;string&gt;
   #include"movie.h"
   #include"actor.h"
  
   class Graph {
  
       private:
           /*Member Variables*/
           std::unordered_map&lt;std::string,std::vector&lt;Movie*&gt;&gt; vertices;
           std::unordered_map&lt;std::string,std::vector&lt;ActorNode*&gt;&gt; edges;
  
       public:
           /*Constructor*/
           Graph() {}
  
           /*Destructor*/
           ~Graph();
  
   };
  </code></pre>
  
  <p>actor.h:</p>
  
  <pre><code> #include&lt;vector&gt;
   #include&lt;unordered_map&gt;
   #include&lt;iostream&gt;
   #include&lt;queue&gt;
   #include&lt;string&gt;
   //#include"actor.h"
   class Movie;   // forward declaration. only way i could get to compile.
   /* (Vertex) Object Class to represent actors */
   class ActorNode {
  
       //can be converted to struct instead of class??
  
       private:
           /*Member Variables*/
           std::string name;
           std::vector&lt;Movie*&gt; movies;
  
       public:
           /*Constructor*/
           ActorNode() : name("") {}
  
           /*Getters and Setters*/
           std::string getName();
           void setName(std::string actor);
  
           std::vector&lt;Movie*&gt; getMovies();
  
           /*Member Functions*/
   };
  </code></pre>
  
  <p>movie.h:</p>
  
  <pre><code>#include&lt;vector&gt;
   #include&lt;unordered_map&gt;
   #include&lt;iostream&gt;
   #include&lt;queue&gt;
   #include&lt;string&gt;
   //#include"movie.h"
   class ActorNode;
   /* Object class to hold movies. Edges? */
   class Movie {
  
       //can be converted to struct instead of class?
  
       private:
           std::string movie;
           int year;
           int weight;
           std::vector&lt;ActorNode*&gt; cast;
  
       public:
           /*Constructor*/
           Movie() : movie(""), year(1), weight(1) {}
  
           /*Getters and Setters*/
           std::string getMovie();
           void setMovie(std::string movie);
  
           int getYear();
           void setYear(int yr);
  
           int getWeight();
           void setWeight(int wt);
  
           std::vector&lt;ActorNode*&gt; getCast();
  
           /*Member Functions*/
  
   };
  </code></pre>
  
  <p>So I am designing these classes to represent a graph for to perform solve the shortest path problem between two actors. (six degrees of kevin bacon) for a project for school.</p>
  
  <p>As you can see, class ActorNode has a vector of Movie pointers and class Movie has a vector of ActorNode pointers.</p>
  
  <p>I wanted to put</p>
  
  <pre><code>#include "actor.h"        in movie.h
  </code></pre>
  
  <p>and</p>
  
  <pre><code>#include "movie.h"        in actor.h
  </code></pre>
  
  <p>but doing this causes an infinite loop to go on and errors of "#include nested too deeply" keep popping up.</p>
  
  <p>putting</p>
  
  <pre><code> #include "graph.h"    in actor.h
  </code></pre>
  
  <p>and</p>
  
  <pre><code> #include "graph.h"    in movie.h
  </code></pre>
  
  <p>also causes a long list of "from :" to pop up before the compiler eventually says</p>
  
  <p>error: previous definition of 'class ActorNode'</p>
  
  <p>The only way I could get it to compile was putting a forward declaration of class Movie in actor.h and a forward declaration of class ActorNode in movie.h</p>
  
  <p>The thing is that feels wrong. Like the vector of class Movie pointers that class ActorNode is holding has absolutely nothing to do the class Movie in actor.h and the vector of class ActorNode pointers that are in class Movie has nothing to do with the class ActorNode in actor.h.</p>
  
  <p>Not really sure how to get the compiler to accept what I want to do:</p>
  
  <p>class ActorNode holds a vector of class Movie pointers</p>
  
  <p>class Movie holds a vector of class ActorNode pointers</p>
  
  <p>class Graph holds two hashmaps, one that holds vectors of pointers to movies that each particular actor has been in (actor name is the key) and the other hashmap holds vectors of pointers to actors (movie name is the key) that each represent the cast of a particular movie. </p>
  
  <p>thank you!</p>