Header file is "graph.h"
#ifndef _GRAPH_H_
#define _GRAPH_H_
#include <map>
#include <vector>
using namespace std;
template <class T>
class VERTEX
{
public:
VERTEX(T inVertex): m_vertex(inVertex), m_visited(false){}
~VERTEX(){}
private:
T m_vertex;
bool m_visited;
};
template <class T>
class GRAPH
{
public:
GRAPH() {}
~GRAPH(){}
typedef VERTEX<T> GRAPHVERTEX;
typedef vector<GRAPHVERTEX> ADJLIST;
typedef map<GRAPHVERTEX, ADJLIST> GRAPHMAP;
void insert(GRAPHVERTEX inSRC, GRAPHVERTEX inDST)
{
GRAPHMAP::iterator itr = m_graph.find(inSRC);
}
private:
GRAPHMAP m_graph;
};
#endif
And test file is
#include "graph.h"
int main( int argc, char**argv)
{
GRAPH<int> *G = new GRAPH<int>();
G->insert(VERTEX<int>(0), VERTEX<int>(2));
return 0;
}