源码文件 test # Graph example from book for connected components 4 # Number of vertices U # Undirected graph # Li…