CSD203_-_FA_2024_-_PE_2872.webp
F

CSD203_-_FA_2024_-_PE_2872.webp

def f1(self, start) - Perform breadth-first traversal from the vertex start (the vertex C) and the results are displayed in three lines. The first line shows only the degree of each vertex corresponding to the second line vertices. The second line shows only the vertex. The third line displays the vertices with their degrees as odd numbers in Parentheses "()". Output in this case like that:
OUTPUT
464543332332 CAEFIGJKHBDL
CAEF(5) IG(3) J(3) K(3) H B(3) D(3) L
def f2(self, start, end) - Using the Dijkstra's shortest path algorithm to find the shortest path from the vertex start (start="C") to the vertex end (end = "K"). (Note that in the weighted matrix, the value 999 is considered as infinity). Write 2 lines to the screen. The first line, display the list of vertices in the shortest path (from start to end). The seocnd line, display the verties and the shortes distance in curly brackets "{}" which is an odd number. Output in this case like that:
OUTPUT
C-D-E-F-K
C-D{1}-E-F{3}-K{5}
3
Zoom

+ 100%
Close
Chưa có bình luận nào.

Thông tin

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

Image metadata

Filename
CSD203_-_FA_2024_-_PE_2872.webp
File size
181.7 KB
Dimensions
960px x 813px

Share this media

Back
Bên trên Bottom