Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Specification: Using Java programming language, do a Depth-first search of the directed graph, starting at the node with the value S (not case sensitive).

Problem Specification:

Using Java programming language, do a Depth-first search of the directed graph, starting at the node with the value S (not case sensitive). List the starting and finishing times of each Node, and the class of each Edge (tree edge, forward edge, back edge, cross edge). Make the starting time of the source node time 1. At many points in the search, you may have to choose which node to explore next. Here are the rules to do so:

  1. If you have a choice among two or more unexplored Node to explore next, there are two cases:
  1. If the values of all Edges are all integers, choose the Edge with the lowest value. If there is a tie, choose the Edge to the Node whose name comes first in lexicographic order. (All node names are unique.)
  2. Otherwise, if the values of the Edges are not all integers (at least one general alphabetical character or non-positive integer), choose the Edge to the Node whose name comes first in lexicographic order.
  1. If you have explored as far as possible from the starting node without exploring every node of the graph, continue from the Node whose name comes first lexicographically from among all unexplored Nodes.

Sample input

image text in transcribed

The program read the input from the textile.

The program read the input from textfileimage text in transcribed

AAA BB val S 67 DDD 99 0 E fig > 999 == Alfa Bravo Charlie Delta Echo -42 4 22 yz 4e 3 2 X 9 != 2 33 2 yes d>e The output for this file should be: Node Alpha Bravo Charlie Delta Echo Start Time 1 2 3 4 5 End Time 10 9 8 7 6 Edge AAA-BB AAA-DDD AAA-EEE BB-AAA BB-BB BB-C BB-DDD BB-E C-BB C-DDD C-E DDD-AAA DDD-BB DDD-C DDD-E E-DDD E-E Type F F B B T F F B F B B B T B B AAA BB val S 67 DDD 99 0 E fig > 999 == Alfa Bravo Charlie Delta Echo -42 4 22 yz 4e 3 2 X 9 != 2 33 2 yes d>e The output for this file should be: Node Alpha Bravo Charlie Delta Echo Start Time 1 2 3 4 5 End Time 10 9 8 7 6 Edge AAA-BB AAA-DDD AAA-EEE BB-AAA BB-BB BB-C BB-DDD BB-E C-BB C-DDD C-E DDD-AAA DDD-BB DDD-C DDD-E E-DDD E-E Type F F B B T F F B F B B B T B B

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago