ICS 441Due 16 May 2013Summer, 2013 [Type text][Type text][Type text] ICS 340 Programming Project, Deliverable B Specification: Start with your Java program “prog340”, ideally it should be working...

1 answer below »
I need help performing a depth first search.


ICS 441Due 16 May 2013Summer, 2013[Type text][Type text][Type text] ICS 340 Programming Project, Deliverable B Specification: Start with your Java program “prog340”, ideally it should be working for Deliverable A. Perform Depth First Search (DFS) on the graph, starting from the root node (the node with value “S”). When you have the choice of two or more unexplored nodes to visit next, choose the nearest one. Break ties alphabetically by name. If your depth first search terminates without visiting every node in the graph, start again from the first node in the graph in alphabetical order by name that hasn’t been visited. Output: 1. The discovery and finish times of each node in the graph. 2. The classification of each edge in the graph. (Tree, Forward, Back, or Cross.) As will always be the case in this class, the program must be written in Java and must run on the University Windows computer systems. Submit the Java source code to the open Deliverable B submission folder. You must submit the whole Eclipse package. Sample Output Input File: ~ val ABCDE Alpha S ~32~5 Bravo ~ 3~42~ CharlieG ~~~~~ Delta ~ 4~4~2 Echo ~~322~ Which creates the following graph: Yields output: DFS of graph: Node Disc Finish A 1 10 B 6 7 C 2 9 D 4 5 E 3 8 Edge Classification: Edge Type A->B Forward A->C Tree A->E Forward B->A Back B->C Back B->D Cross C->E Tree D->A Back D->C Back D->E Back E->B Tree E->C Back E->D Tree Submit: Submit your code as an Eclipse package. Do not include test files. Grading: This deliverable is worth 70 points: 55 points for correctness, 5 points for design, 5 points for documentation & style, 5 points for regression testing Deliverable A, Correctness of Deliverable B will be assessed for 5 files. Due Dates: The program is due on Saturday, October 2nd at noon for full credit in the D2L “Deliverable B” dropbox. For 80% of credit earned, you may (re)submit it by noon Saturday, October 16th. The time of submission is the time that D2L lists the file as submitted
Answered 1 days AfterSep 30, 2021

Answer To: ICS 441Due 16 May 2013Summer, 2013 [Type text][Type text][Type text] ICS 340 Programming...

Amar Kumar answered on Oct 02 2021
135 Votes
using namespace std;

// graph class
class Graph
{
int V; // No. of vertices
listt> *adjList; // adjacency lists
public:
Graph(int V) //graph Constructor
{
this->V = V;
adjList = new list[V];
}
void addEdge(int v, int w) // add an edge to graph
{
adjList[v].push_back(w); // Add w to v’s list.
}
void DFS(); // DFS traversal

// utility function called by DFS
void DFSUtil(int s, vector &visited);
};

//traverses all not visited vertices...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here