/* * File: Graph.hpp * Author: Ajith John * * Created on 27 November, 2013 */ #ifndef GRAPH_HPP #define GRAPH_HPP #include #include #include using namespace std; // Graph class represents a directed graph using adjacency list representation class Graph { int V; // No. of vertices vector< list > adj; // Vector of adjacency lists void DFSUtil(int v, vector &visited, list &relatives); // A function used by DFS public: Graph(int V); // Constructor ~Graph(); //Destructor void addEdge(int v, int w); // function to add the edge v-->w to graph void DFS(int v, list &relatives); // DFS traversal of the vertices reachable from v }; #endif /* GRAPH_HPP */