CSD203_-_PE_-_SU_2024_2156.webp
Todo2000

CSD203_-_PE_-_SU_2024_2156.webp

  • Media owner Todo2000
  • Ngày thêm
In this question you should complete some methods in Graph.py file.
The class Graph is the implementation of a graph. The following methods should be completed:
def f1(self, start) - Perform depth-first traversal from the vertex start (the vertex A) and the results are displayed in two lines. The first line shows only the vertices. The second line shows the vertices with their degree are odd number in square bracket "[]". Hint: copy depthFirst(...) and depth(...)to depthFirst2(...) depth2(...) and modify them. Output in this case like that:
OUTPUT
ABCFDELKGHIJ
A[3] B C F D[3] E[3] L[3] K[3] G[5] HIJ
def f2(self, start) - Suppose the graph has a Euler's cycle, apply the pseudocode in the Graph.py file to write statements to find the Euler's cycle from the vertex start (in this case start = "A"). The results are displayed in two lines. The first line shows the Euler cycle (in alphabet order). The second line shows the Euler cycle with the vertices having degree smaller than 6 in square bracket "[]". The output in this case
like that:
OUTPUT
AHIJKJGHGBGFKEFCFEDCBA
A[2] H[4] 1[2] J[4] K[4] J[4] G H[4] GB[4] GFK[4] E[4] FC[4] FE[4] D[2] C[4] B[4] A[2]
Close
+ 100%
Zoom
Chưa có bình luận nào.

Thông tin

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

Image metadata

Filename
CSD203_-_PE_-_SU_2024_2156.webp
File size
218.7 KB
Dimensions
1920px x 803px

Share this media

Back
Bên trên Bottom