Lập trình C nâng cao - Fit Lec 7 (HUST) GV.AnhTT
- ページ数
- 6
- 形式
- サイズ
- 195 KB
- Trường
- Đại học Bách khoa Hà Nội
- 閲覧数
- 0
- コメント
- 0
- Lượt tải
- 0
プレビューを生成中...
Slide bài giảng về thuật toán duyệt đồ thị, tập trung vào phương pháp duyệt theo chiều rộng (BFS) và ứng dụng tìm đường đi ngắn nhất trên đồ thị không trọng số. Bài giảng của GV Anh TT tại HUST với các ví dụ minh họa và bài tập thực hành.
- ドキュメント名
- Lập trình C nâng cao - Fit Lec 7 (HUST) GV.AnhTT
- 学校 / コース
- Đại học Bách khoa Hà Nội · Lập trình C
- 著者(ドキュメント内)
- AnhTT
- 内容
- Tài liệu trình bày về các thuật toán duyệt đồ thị, tập trung vào BFS với mã giả và ví dụ minh họa. BFS cũng được áp dụng để giải quyết bài toán tìm đường đi ngắn nhất không có trọng số.
- 目次
- Graph traversal
- Breadth-First Search Traversal
- Breadth-First Traversal
- Unweighted Shortest Path Problem
- ページ数
- 6 ページ
- アップロード者
- lienhejb
説明
Trích nội dung tài liệu
Graph traversal anhtt-fit@mail.hut.edu.vn Graph Traversal We need also algorithm to traverse a graph like for a tree Graph traversal may start at an arbitrary vertex. (Tree traversal generally starts at root vertex) Two difficulties in graph traversal, but not in tree traversal: The graph may contain cycles; The graph may not be connected. There are two important traversal methods: Breadth-first traversal, based on breadthfirst search (BFS). Depth-first traversal, based on depth-first search (DFS). 1 Breadth-First Search Traversal Breadth-first traversal of a graph: Is roughly analogous to level-by-level traversal of an ordered tree Start the traversal from an arbitrary vertex; Visit all of its adjacent vertices; Then, visit all unvisited adjacent vertices of those visited vertices in last level; Continue this process, until all vertices have been visited. 0 8 9 2 source 0 4 3 5 7 1 4 3 6 9 2 source 1 8 7 5 6 Breadth-First Traversal The pseudocode of breadth-first traversal algorithm: BFS(G,s) for each vertex u in V do visited[u] = false Report(s) visited[s] = true initialize an empty Q Enqueue(Q,s) While Q is not empty do u = Dequeue(Q) for each v in Adj[u] do if visited[v] = false then Report(v) visited[v] = true Enqueue(Q,v) 2 An Example Breadth-First Search Traversal Example of breadth-first traversal Visit the first vertex (in this example 0) Visit its adjacent nodes in Adj[0] :7 5 2 1 6 Visit adjacent unvisited nodes of the those visited in last level Visit adjacent unvisited nodes of the those visited in last level Visit adjacent nodes of 7 in Adj[7] : 4 Visit adjacent nodes of 5 in Adj[5] : 3 Visit adjacent nodes of 2 in Adj[2] : none Visit adjacent nodes of 1 in Adj[1] : none Visit adja
よくある質問
このドキュメントは無料ですか?
はい。「Lập trình C nâng cao - Fit Lec 7 (HUST) GV.AnhTT」は無料です。ログインして「ダウンロード」をクリックするだけで、元のファイルを取得できます。
このドキュメントは何ページありますか?
このドキュメントは 6 ページあります(Lập trình C コース用)。ダウンロードする前にオンラインでプレビューできます。
ダウンロードする前にプレビューできますか?
はい。このページにあるオンラインリーダーでドキュメントをプレビューし、その後ダウンロードするかどうかを決めることができます。
Lập trình C nâng cao - Fit Lec 7 (HUST) GV.AnhTT
プレビューを生成中...
Trích nội dung tài liệu
Graph traversal anhtt-fit@mail.hut.edu.vn Graph Traversal We need also algorithm to traverse a graph like for a tree Graph traversal may start at an arbitrary vertex. (Tree traversal generally starts at root vertex) Two difficulties in graph traversal, but not in tree traversal: The graph may contain cycles; The graph may not be connected. There are two important traversal methods: Breadth-first traversal, based on breadthfirst search (BFS). Depth-first traversal, based on depth-first search (DFS). 1 Breadth-First Search Traversal Breadth-first traversal of a graph: Is roughly analogous to level-by-level traversal of an ordered tree Start the traversal from an arbitrary vertex; Visit all of its adjacent vertices; Then, visit all unvisited adjacent vertices of those visited vertices in last level; Continue this process, until all vertices have been visited. 0 8 9 2 source 0 4 3 5 7 1 4 3 6 9 2 source 1 8 7 5 6 Breadth-First Traversal The pseudocode of breadth-first traversal algorithm: BFS(G,s) for each vertex u in V do visited[u] = false Report(s) visited[s] = true initialize an empty Q Enqueue(Q,s) While Q is not empty do u = Dequeue(Q) for each v in Adj[u] do if visited[v] = false then Report(v) visited[v] = true Enqueue(Q,v) 2 An Example Breadth-First Search Traversal Example of breadth-first traversal Visit the first vertex (in this example 0) Visit its adjacent nodes in Adj[0] :7 5 2 1 6 Visit adjacent unvisited nodes of the those visited in last level Visit adjacent unvisited nodes of the those visited in last level Visit adjacent nodes of 7 in Adj[7] : 4 Visit adjacent nodes of 5 in Adj[5] : 3 Visit adjacent nodes of 2 in Adj[2] : none Visit adjacent nodes of 1 in Adj[1] : none Visit adja
- ドキュメント名
- Lập trình C nâng cao - Fit Lec 7 (HUST) GV.AnhTT
- 学校 / コース
- Đại học Bách khoa Hà Nội · Lập trình C
- 著者(ドキュメント内)
- AnhTT
- 内容
- Tài liệu trình bày về các thuật toán duyệt đồ thị, tập trung vào BFS với mã giả và ví dụ minh họa. BFS cũng được áp dụng để giải quyết bài toán tìm đường đi ngắn nhất không có trọng số.
- 目次
- Graph traversal
- Breadth-First Search Traversal
- Breadth-First Traversal
- Unweighted Shortest Path Problem
- ページ数
- 6 ページ
- アップロード者
- lienhejb
コメント (0)
まだコメントはありません。最初のコメントを書きましょう!
K5 Bộ đề luyện thi Trạng Nguyên Tiếng Việt (NXB DHQG)
K2 Bộ đề luyện thi Trạng Nguyên Tiếng Việt (NXB DHQG)
K3 Bộ đề luyện thi Trạng Nguyên Tiếng Việt (NXB DHQG)
K4 Bộ đề luyện thi Trạng Nguyên Tiếng Việt (NXB DHQG)
K1 Bộ đề luyện thi Trạng Nguyên Tiếng Việt (NXB DHQG)

コメント (0)
まだコメントはありません。最初のコメントを書きましょう!