Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For the following problems, assume that vertices are ordered alphabetically in t

ID: 3692922 • Letter: F

Question

For the following problems, assume that vertices are ordered alphabetically in the adjacency lists (thus you will visit adjacent vertices in alphabetical order). Execute a Breadth-First Search on the graph G_1, starting on vertex a. Specify the visit times for each node of the graph. Execute a Depth-First Search on the graph G_1, starting on vertex a. Specifiy the visit and finish times for each node of the graph For each edge in your graph identify whether it is a tree edge, back edge, forward edge, or a cross edge. Which edges would you remove to make your graph to make it into a DAG?

Explanation / Answer

Answer for Question:

Breadth for Search(BFS) of G1 Graph:

As given in problem statement start at vertex node a.

BFS is always looking at same level of nodes.
If any cycles found will remove those.

Step 1: Start a has links b and d ..

   a-----
Step 2: Start b has a and d (a is already visted )

   a-----b-----d
   and here a , b and d are cycle. Removed the cycle
  
Step 3: Start d has links c and e are at same level
   first start with e and then c

   a----b----d
           |
           |
           e
   and   
  
   a----b----d-----c
           |
           |
           e
  
Step 4: Here C and e and d are in cycle removed the cycle

Finally Node f is left ..so f has link with

   a----b----d-----c
           |
           |
           e-----f
          
          
Answer for Question 2:

Depth first Search(DFS):

As algorithm says start from node to depth of the node.once depth reached come back to root node and start the neighbouring node visits

Step 1: Start with node a

       a----
      
Step 2: Start from node b

       a----b
      
Step 3: Start from d ..

       a----b
           |
           |
           d
Step 4: Start from c

       a----b
           |
           |
       c----d

      
Step 4: Start from f

       a----b
           |
           |
       c----d
       |
       |
       f
from node a to f is reached so cycle exit here for f and d . Remove the cycle

Step 5: Start from e

       a----b
           |
           |
       c----d
       | |
       |   |
       f e

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote