I cant seem to find the correct syntax to point the iterator to the linked list. The G vector holds a vertex and a vertex has a linked list of edges. this makes up a graph, I can not change the Graph.h file (prof orders). I am trying to print out the contents of each Vectors name and its linked list name and weight. I know I will need this syntax for later functions.
[template <class V, class W> // V is the vertex class; W is edge weight class
struct edgeRep
{
V name; // Vertex name
W weight; // Edge weight
};
template <class V, class W>
struct vertex // Array cell structure for graph
{
typedef edgeRep<V,W> edge;
V name; // Vertex name
int visited; // Used during traversal, Breadth-First or Depth-First
list<edge> edgelist; // Pointer to edge list
};
template <class V, class W>
class Graph
{
protected:// protected member functions
std::vector< vertex<V,W> > G;// Main graph array for adjacency list representation
public:
//other functions....
};
/*****
NOTE:i did get this other function, working and i can see that the variables are in there
******/
template <typename V, typename W> //templated boilerplate
void Graph<V,W>::GetGraph()
{
ifstream inF;
char g;//garbage
string filename;//change to templated V name later
int weight;//change to templated W name later
vertex<V,W> city;//temp vector to add citys
edgeRep<V,W> path;//temp path to add adj citys
//ask for graph textfile
cout<<"Enter the fully qualified file path including\n"
<<"file name for the Graph: ";
cin>>filename;
inF.open(filename.c_str());
while (!inF.eof())
{
city.name = "";
inF >> g;
while(g != ' ')
{
city.name += g;
inF.get(g);
}
cout << "new city is: " << city.name << endl;
do
{
inF >> g;
if(g != '#')
{