#include #include #include #include #include "Graph.cpp" using namespace std; int main() { //graph.DepthFirstSearch(); int nodes1[]={10, 20, 30, 40}; Graph graph1(nodes1,4,false); graph1.AddEdge (10,30); graph1.AddEdge (10,20); graph1.AddEdge (30,40); graph1.Display(); //Interactively build a graph: nodes are string type... cout <<"Now let's build a graph!\n"; cout <<"Enter the number of nodes in the graph:"; int N; do{ cin >> N; } while (N<=0); //Read in nodes string * nodes = new string[N]; for (int i=0;i> nodes[i]; } //Directed or not cout <<"Is it directed or not (Y/N)"; char answer; do { cin >> answer; } while (answer!='Y' && answer!='N'); Graph graph(nodes,N,answer=='Y'); //if answer=='Y' directed //read in edges cout <<"Enter the number of edges: "; int M; do { cin >> M; } while (M<0); string fromNode, toNode; for (int i=0;i> fromNode; cout <<"to which node:"; cin >> toNode; graph.AddEdge (fromNode, toNode); } graph.Display(); graph.BFS_Explore (nodes[0]); }