[A,0]->[B,3]
[B,0]->[A,3]
This is the data structure i plan to use where the Y coord is the vector and the x coord is the list. each node in the list will contain a string and a integer (as shown above). lets pretend this is the class that contains the declaration of the vector of linked lists, well call it Graph, since this is a graphing assignment...[Note this code wont compile as i sketched it up to make it look simpler for others to read.]
class Graph
{
public:
Graph(){...}
~Graph(){...}
private:
class Edge
{
public:
Edge(string vertex, int weight)
{
m_vertex = vertex;
m_weight = weight;
}
~Edge(){...}
string m_vertex;
int m_weight;
};
vector< list < Edge > > adjacency_list; //the vector of linked lists
};
In a completely different .h file I would have this class declared:
class Modify_Graph
{
public:
void access_Edge();
//......
private:
//......
};
this is contained in the Modify_graph.cpp file
void Modify_Graph::access_Edge()
{
adjacency_list adjList;
cout << "The very first vertex is: ";
cout << adjList[0].front().m_vertex << endl;
}
when I compile that it tells me that it cannot find 'adjacency_list' is there a way I could get it? In a more complex program I tried passing it by reference, returning it, and other things but none of them seemed to work. I am completely unsure what to do.