An implementation of a graph is given as a list representation.The graph consists of nodes. Every node has an integer value asunique data key and a set of neighbours. Implement the depth-firstsearch (DFS) for this graph data structure. Read the comments inthe source code and implement the missing methods accordingly. Youcan use std::stack and std::queue for the implementation.
#include <iostream>
#include <set>
using namespace std;
/*
* The data structure for the graph.
* Every node holds some data (int) and a set of pointers toneighbour nodes.
*
* Don’t modify this struct!
*/
struct Node {
int data;
set<Node*> neighbours;
Node () {
data = -1;
}
Node (int n) {
data = n;
}
void addNeighbour (Node*
PayPal Gateway not configured
PayPal Gateway not configured