Lập trình C nâng cao - Fit Lec 9 (HUST) GV.AnhTT
Tài liệu giảng dạy về đồ thị có hướng, bao gồm các khái niệm cơ bản như đồ thị liên thông, chu trình, cây, cũng như các thuật toán duyệt đồ thị (BFS, DFS), tìm thành phần liên thông, và sắp xếp topo trên đồ thị có hướng không chu trình (DAG).
正在生成预览...
Directed graphs anhtt-fit@mail.hut.edu.vn dungct@it-hut.edu.vn http://www.4shared.com/file/43395119/3907952d/lect08. html Terminology Connected graph A graph is connected if and only if there exists a path between every pair of distinct vertices Sub-graph A graph with the vertex and edge set being subsets of the original graph Connected Components A connected component of a graph is a maximally connected subgraph of a graph Cycle A path in a graph that starts and ends at the same vertex Tree A graph G is a tree if and only if it is connected and acyclic Directed Graph A graph whose the edges (arcs) are directional Directed Acyclic Graph A directed graph with no directed cycles 1 Directed Graphs A directed graph can be represented by an adjacency matrix/list the same way as in undirected graph, except: An arc (u, v) only contributes to 1 entry in the adj. matrix or 1 node in the adj. list Paths/Cycles A directed graph can also contain paths and cycles (“directed paths” and “directed cycles”) b a Graph on top has directed paths and directed cycle Graph on bottom has directed paths but NO directed cycle (acyclic) c b a c 2 Graph traversal BFS and DFS can be used to traverse a directed graph, the same way as in undirected graph To check for connectivity of a graph run BFS or DFS using an arbitrary vertex as the source. If all vertices have been visited, then the graph is connected; otherwise, the graph is disconnected Finding Connected Components Run DFS or BFS from a vertex the set of visited vertices form a connected component Find another vertex i which has not been visited before, run DFS or BFS from it we have another connected component Repeat the steps until all vertices are visited Running time is O(ni + mi ) = O ( i mi ) = O( n
… 下载原始文件以阅读完整文档。
- 文档名称
- Lập trình C nâng cao - Fit Lec 9 (HUST) GV.AnhTT
- 学校 / 课程
- Đại học Bách khoa Hà Nội · Lập trình C
- 作者(文档中)
- AnhTT
- 内容
- Tài liệu này tập trung vào đồ thị có hướng, bao gồm định nghĩa, biểu diễn, duyệt đồ thị, tìm thành phần liên thông và giới thiệu về sắp xếp tôpô cho đồ thị không chu trình.
- 目录
- Directed graphs
- Terminology
- Connected graph
- Sub-graph
- Connected Components
- Cycle
- Tree
- Directed Graph
- Directed Acyclic Graph
- Directed Graphs
- Paths/Cycles
- Graph traversal
- Finding Connected Components
- A complete graph API
- Topological Sort
- 页数
- 12 页
- 上传者
- lienhejb
常见问题
此文档免费吗?
是的。“Lập trình C nâng cao - Fit Lec 9 (HUST) GV.AnhTT”是免费的 — 只需登录并点击“下载”即可获取原始文件。
这份文档有多少页?
该文档共有 12 页,适用于课程 Lập trình C。您可以在下载前进行在线预览。
我可以在下载前预览吗?
是的。您可以通过在线阅读器直接在本页面预览此文档,然后再决定是否下载。

评论 (0)
暂无评论。快来抢沙发吧!