CSD201_-_PEQN_-_SU_2024_-_L1_2151.webp
Quốc Hùng2

CSD201_-_PEQN_-_SU_2024_-_L1_2151.webp

The class Graph is the implementation of a graph. The following methods should be completed:
void f1() - Perform breadth-first traversal (to the file f1.txt) from the vertex i=2 (the vertex C) but display 6 vertices from the 2nd vertex to the 7th vertex only. Hint: copy breadth(...) to breadth2(...)and modify the latter one. Content of the output file f1.txt must be:
CAHBDEIGF
AHBDEI
void f2() - Apply the Dijkstra's shortest path algorithm to find (1) the shortest path from vertext 2 (C) to vertex 5 (F), then (2) from vertex 1 (B) to vertex 6 (G). Write 3 lines to the file f2.txt: line 1 contains vertices in shortest path (1), line 2 contains the shortest distance in (1), line 3 contains first 4 vertices selected into the set S in (2). (Note that in the weighted matrix, the value 99 is considered as infinity). Output in the file f2.txt must be the following:
CEDF
12
BCHA
Zoom
100%
Close
Chưa có bình luận nào.

Thông tin

Category
CSD201
Thêm bởi
Quốc Hùng2
Ngày thêm
Lượt xem
1,973
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
CSD201_-_PEQN_-_SU_2024_-_L1_2151.webp
File size
162.4 KB
Dimensions
1025px x 792px

Share this media

Back
Bên trên Bottom