Lập trình C nâng cao - Fit Lec 10 (HUST) GV.AnhTT
正在生成预览...
Slide bài giảng về đồ thị có trọng số (Weighted Graph) và các thuật toán tìm đường đi ngắn nhất, bao gồm khái niệm relaxation và thuật toán Dijkstra với cách cài đặt bằng C.
描述
Weighted graph anhtt-fit@mail.hut.edu.vn Weighted Graph We can add attributes to edges. We call the attributes weights. For example if we are using the graph as a map where the vertices are the cites and the edges are highways between the cities. Then if we want the shortest travel distance between cities an appropriate weight would be the road mileage. If we are concerned with the dollar cost of a trip and went the cheapest trip then an appropriate weight for the edges would be the cost to travel between the cities. 1 Shortest Path Digraph G = (V,E) with weight function W: E → R (assigning real values to edges) Weight of path p = v1 → v2 → … → vk is k −1 w( p) = w(vi , vi +1 ) i =1 Shortest path = a path of the minimum weight Applications static/dynamic network routing robot motion planning map/route generation in traffic Shortest-Path Problems Shortest-Path problems Single-source (single-destination). Find a shortest path from a given source (vertex s) to each of the vertices. Single-pair. Given two vertices, find a shortest path between them. Solution to single-source problem solves this problem efficiently, too. All-pairs. Find shortest-paths for every pair of vertices. Dynamic programming algorithm. 2 Negative Weights and Cycles? Negative edges are OK, as long as there are no negative weight cycles (otherwise paths with arbitrary small “lengths” would be possible) Shortest-paths can have no cycles (otherwise we could improve them by removing cycles) Any shortest-path in graph G can be no longer than n – 1 edges, where n is the number of vertices Relaxation For each vertex v in the graph, we maintain v.d(), the estimate of the shortest path from s, initialized to ∞ at the start Relaxing an edge (u,v) means testing whether we can improve the
AI 摘要
- 文档名称
- Lập trình C nâng cao - Fit Lec 10 (HUST) GV.AnhTT
- 学校 / 课程
- Đại học Bách khoa Hà Nội · Lập trình C
- 作者(文档中)
- AnhTT
- 内容
- Tài liệu này trình bày về đồ thị có trọng số và bài toán đường đi ngắn nhất, giới thiệu khái niệm Relaxation và thuật toán Dijkstra. Nó cũng đề cập đến các vấn đề như trọng số âm và cung cấp các yêu cầu cho API cài đặt đồ thị có trọng số.
- 目录
- 此文档没有清晰的目录。
- 页数
- 7 页
- 上传者
- lienhejb
常见问题
此文档免费吗?
是的。“Lập trình C nâng cao - Fit Lec 10 (HUST) GV.AnhTT”是免费的 — 只需登录并点击“下载”即可获取原始文件。
这份文档有多少页?
该文档共有 7 页,适用于课程 Lập trình C。您可以在下载前进行在线预览。
我可以在下载前预览吗?
是的。您可以通过在线阅读器直接在本页面预览此文档,然后再决定是否下载。
Lập trình C nâng cao - Fit Lec 10 (HUST) GV.AnhTT
正在生成预览...
Weighted graph anhtt-fit@mail.hut.edu.vn Weighted Graph We can add attributes to edges. We call the attributes weights. For example if we are using the graph as a map where the vertices are the cites and the edges are highways between the cities. Then if we want the shortest travel distance between cities an appropriate weight would be the road mileage. If we are concerned with the dollar cost of a trip and went the cheapest trip then an appropriate weight for the edges would be the cost to travel between the cities. 1 Shortest Path Digraph G = (V,E) with weight function W: E → R (assigning real values to edges) Weight of path p = v1 → v2 → … → vk is k −1 w( p) = w(vi , vi +1 ) i =1 Shortest path = a path of the minimum weight Applications static/dynamic network routing robot motion planning map/route generation in traffic Shortest-Path Problems Shortest-Path problems Single-source (single-destination). Find a shortest path from a given source (vertex s) to each of the vertices. Single-pair. Given two vertices, find a shortest path between them. Solution to single-source problem solves this problem efficiently, too. All-pairs. Find shortest-paths for every pair of vertices. Dynamic programming algorithm. 2 Negative Weights and Cycles? Negative edges are OK, as long as there are no negative weight cycles (otherwise paths with arbitrary small “lengths” would be possible) Shortest-paths can have no cycles (otherwise we could improve them by removing cycles) Any shortest-path in graph G can be no longer than n – 1 edges, where n is the number of vertices Relaxation For each vertex v in the graph, we maintain v.d(), the estimate of the shortest path from s, initialized to ∞ at the start Relaxing an edge (u,v) means testing whether we can improve the
阅读全文
- 文档名称
- Lập trình C nâng cao - Fit Lec 10 (HUST) GV.AnhTT
- 学校 / 课程
- Đại học Bách khoa Hà Nội · Lập trình C
- 作者(文档中)
- AnhTT
- 内容
- Tài liệu này trình bày về đồ thị có trọng số và bài toán đường đi ngắn nhất, giới thiệu khái niệm Relaxation và thuật toán Dijkstra. Nó cũng đề cập đến các vấn đề như trọng số âm và cung cấp các yêu cầu cho API cài đặt đồ thị có trọng số.
- 目录
- 此文档没有清晰的目录。
- 页数
- 7 页
- 上传者
- 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)
暂无评论。快来抢沙发吧!