Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1 Consider the adjacency list representation of a graph with 8 vertices and 9 edges: A: E F B B: C A C: B
Question 1
Consider the adjacency list representation of a graph with 8 vertices and 9 edges: A: E F B B: C A C: B G F D: H G E: A F: G C A G: F D C H: D Here is a graphical representation of the same graph: (A)-------------(B)-------------(C) (D) |\ /| /| | \ / | / | | \ / | / | | \ / | / | | \ / | / | | \ / | / | | \ / | / | | \ / | / | | \ / | / | | \ / | / | | \ / | / | | \ / | / | | \ / | / | | \ / | / | | \ / |/ | (E) (F)-------------(G) (H) Run depth first search from vertex A. Give the sequence in which depth first search first visits the vertices. Make sure that you use the order given in the adjacency list!
Options:
| |||
| |||
| |||
| |||
|
Question 2 Consider the adjacency list representation of a graph with 8 vertices and 10 edges: 0: 1 1: 0 2 4 5 2: 1 6 5 3 3: 6 2 4: 1 5 5: 1 4 2 6: 3 7 2 7: 6 Here is a graphical representation of the same graph: (0)-------------(1)-------------(2)-------------(3) /| /| / / | / | / / | / | / / | / | / / | / | / / | / | / / | / | / / | / | / / | / | / / | / | / / | / | / / | / | / / | / | / / | / | / / |/ |/ (4)-------------(5) (6)-------------(7) Run depth first search from vertex 6 and calculate the values of the edgeTo[] array. Match the edgeTo[] array elements with their calculated values.
Note that edgeTo[6] is not included since it is not assigned for a new DepthFirstPaths(G, 6) instance with source vertex 6. Be sure to use the order from the adjacency list!
edgeTo[0]
edgeTo[1]
edgeTo[2]
edgeTo[3]
edgeTo[4]
edgeTo[5]
edgeTo[7]
Question 3
Consider the adjacency-lists representation of a graph with 8 vertices and 10 edges: A: B B: A C E F C: B G F D D: G C E: B F F: B E C G: D H C H: G Here is a graphical representation of the same graph: (A)-------------(B)-------------(C)-------------(D) /| /| / / | / | / / | / | / / | / | / / | / | / / | / | / / | / | / / | / | / / | / | / / | / | / / | / | / / | / | / / | / | / / | / | / / |/ |/ (E)-------------(F) (G)-------------(H) Run breath-first search from vertex A. Give the sequence in which the vertices are dequeued from the FIFO queue. Make sure that you use the order in the adjacency list!
Options:
A B C F E G D H | |
A B E F C G D H | |
A B C F E G D H | |
A B E F C D G H | |
A B C E F G D H |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started