Hot Search : Source embeded web remote control p2p game More...
Location : Home Search - dfs stack
Search - dfs stack - List
DL : 0
(1)自选存储结构,输入含n个顶点(用字符表示顶点名称)和e条边的图G; (2)指定任意顶点x为初始顶点,对图G作DFS遍历,输出DFS(深度优先)顶点序列(提示:使用栈实现DFS); (3)指定任意顶点x为初始顶点,对图G作BFS(广度遍历),输出BFS顶点序列(提示:使用队列实现BFS); (5)输入顶点x,查找图G:若存在含x的顶点,则删除该结点及与之相关连的边,并作DFS遍历(执行操作3);否则输出信息“不存在x”; (6)判断图G是否是连通图,输出信息“YES”/“NO”; (7)如果选用的存储结构是邻接矩阵,则用邻接矩阵的信息生成图G的邻接表-(1) on-demand storage structure, input containing n vertices (with characters in the name of that vertex) and e edges of the graph G (2) specify arbitrary vertex x as the initial vertex of the graph G for the DFS traversal, output DFS (depth-first) vertex sequence (Hint: Use the stack to achieve DFS) (3) specify arbitrary vertex x as the initial vertex of the graph G for the BFS (breadth traversal), the output sequence of BFS vertex (hint: the realization of the use of queue BFS) (5) input vertex x, find graph G: If there is a vertex with x, then the deletion of the nodes and edges associated with them, and DFS traversal (3 steps) Otherwise output "does not exist x" (6) to determine whether graph G is a connected graph, output "YES"/"NO" (7) If I choose the storage structure is the adjacency matrix, the adjacency matrix of the information used to generate the adjacency list graph G
Date : 2025-12-21 Size : 3kb User : 涂舒
CodeBus is one of the largest source code repositories on the Internet!
Contact us :
1999-2046 CodeBus All Rights Reserved.