CSD201_-_FA_2024_-_PE_-_s_-_3_2874.webp
N

CSD201_-_FA_2024_-_PE_-_s_-_3_2874.webp

void f1() - Perform depth-first traversal (to the file f1.txt) from the vertex i=4 (the vertex E) but display 5 vertices with their degrees from the 2nd vertex to the 6th vertex only. Hint: copy depth(...) to depth2(...) and modify the latter one. The array int deg[] already declared in the class Graph. You should calculate d[i] = degree of the vertex i, i=0,1,..,n-1 and use the function fvisitDeg(...) to display a vertice with degree to file. Content of the output file f1.txt must be:
EBACFHIDG
B(3) A(3) C(3) F(1) H(2)
void f2()- Apply the Dijkstra's shortest path algorithm to find the shortest path from vertext 0 (A)to vertex 6 (G). Write 3 lines to the file f2.txt: line 1 contains the last 3 vertices selected into the set S, line 2 contains labels of vertices in line 1, line 3 contains the 1st, 4th and last vertices in shortest path and shortest distance. (Note that in the weighted matrix, the value 99 is considered as infinity. When the vertex v is selected to the set S, its label=shortest distance from starting vertex to it). Output in the file f2.txt must be the following:
HFG
12 17 22
AEG 22
Zoom
Close
+ 100%
Chưa có bình luận nào.

Thông tin

Category
CSD201
Thêm bởi
Naobito2000
Ngày thêm
Lượt xem
1,229
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
CSD201_-_FA_2024_-_PE_-_s_-_3_2874.webp
File size
200.3 KB
Dimensions
1920px x 803px

Share this media

Back
Bên trên Bottom