1. Trang chủ
  2. » Luận Văn - Báo Cáo

Giáo trình bài tập dsp chapter6 student 19072015

69 316 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 69
Dung lượng 836,52 KB

Nội dung

More About Graphs Huynh Tuong Nguyen, Tran Vinh Tan Chapter More About Graphs Discrete Structures for Computing on December 25, 2014 Contents Connectivity Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring Huynh Tuong Nguyen, Tran Vinh Tan Faculty of Computer Science and Engineering University of Technology - VNUHCM 9.1 Acknowledgement More About Graphs Huynh Tuong Nguyen, Tran Vinh Tan Contents Connectivity Some slides about Euler and Hamilton circuits are created by Chung Ki-hong and Hur Joon-seok from KAIST Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring 9.2 Contents More About Graphs Huynh Tuong Nguyen, Tran Vinh Tan Connectivity Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Contents Connectivity Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs Planar Graphs Graph Coloring Graph Coloring 9.3 More About Graphs Paths and Circuits a b c Huynh Tuong Nguyen, Tran Vinh Tan Contents d e f Connectivity Paths and Circuits Euler and Hamilton Paths Simple path of length Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem a b c Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring d e f Circuit of length 9.4 More About Graphs Path and Circuits Huynh Tuong Nguyen, Tran Vinh Tan Definition (in undirected graph) • Path (đường đi) of length n from u to v: a sequence of n edges {x0 , x1 }, {x1 , x2 }, , {xn−1 , xn }, where x0 = u and xn = v • A path is a circuit (chu trình) if it begins and ends at the same vertex, u = v Contents Connectivity Paths and Circuits • A path or circuit is simple (đơn) if it does not contain the same edge more than once Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem a b c a b c Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring d e Simple path f d e f Not simple path 9.5 Path and Circuits More About Graphs Huynh Tuong Nguyen, Tran Vinh Tan Contents Connectivity Definition (in directed graphs) Path is a sequence of (x0 , x1 ), (x1 , x2 ), , (xn−1 , xn ), where x0 = u and xn = v Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring 9.6 More About Graphs Connectedness in Undirected Graphs Huynh Tuong Nguyen, Tran Vinh Tan Definition • An undirected graph is called connected (liên thông ) if there is a path between every pair of distinct vertices of the graph • There is a simple path between every pair of distinct vertices of a connected undirected graph Contents Connectivity Paths and Circuits d e b Euler and Hamilton Paths f Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem a c h g Planar Graphs Graph Coloring Connected graph Disconnected graph Connected components (thành phần liên thông ) 9.7 More About Graphs How Connected is a Graph? Huynh Tuong Nguyen, Tran Vinh Tan d a f g Contents Connectivity Paths and Circuits c bb e Euler and Hamilton Paths h Euler Paths and Circuits Hamilton Paths and Circuits Definition Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm • b is a cut vertex (đỉnh cắt) or articulation point (điểm khớp) What else? • {a, b} is a cut edge (cạnh cắt) or bridge (cầu) What else? Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring 9.8 More About Graphs How Connected is a Graph? b d Huynh Tuong Nguyen, Tran Vinh Tan g Contents a e Connectivity Paths and Circuits Euler and Hamilton Paths Definition • This graph don’t have cut vertices: nonseparable graph (đồ thị phân tách) Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm • The vertex cut is {c, f }, so the minimum number of vertices in a vertex cut, vertex connectivity (liên thông đỉnh) κ(G) = Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring • The edge cut is {{b, c}, {a, f }, {f, g}}, the minimum number of edges in an edge cut, edge connectivity (liên thông cạnh) λ(G) = 9.9 Applications of Vertex and Edge Connectivity More About Graphs Huynh Tuong Nguyen, Tran Vinh Tan • Reliability of networks • Minimum number of routers that disconnect the network • Minimum number of fiber optic links that can be down to disconnect the network Contents Connectivity Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits • Highway network • Minimum number of intersections that can be closed • Minimum number of roads that can be closed Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring 9.10 Question More About Graphs Huynh Tuong Nguyen, Tran Vinh Tan Contents Connectivity Paths and Circuits How to determine a shortest path from u to v in graph G which traverses at most ≤ a given constant number of intermediate vertices Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring 9.55 Traveling Salesman Problem More About Graphs Huynh Tuong Nguyen, Tran Vinh Tan Problem • Given a set of n customers located in n cities and distances for each pair of cities, the problem involves finding a round-trip with the minimum traveling cost • The vehicle must visit each customer exactly once and return to its point of origin also called depot • The objective function is the total cost of the tour • N P-complete: all known techniques for obtaining an exact solution require an exponentially increasing number of steps (computing resources) as the problems become larger • TSP is one of the most intensely studied problems in computational mathematics, yet no effective solution method Contents Connectivity Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring 9.56 More About Graphs Traveling Salesman Problem b Huynh Tuong Nguyen, Tran Vinh Tan c 2 a Contents d Connectivity Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits e Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm • The total number of possible Hamilton circuit is (n − 1)!/2 • For example, if there are 25 customers to visit, the total number of solutions is 24!/2 = 3.1 × 1023 Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring • If the depot is located at node 1, then the optimal tour is − − − − − with total cost equal to 11 9.57 Vehicle Routing Problem More About Graphs Huynh Tuong Nguyen, Tran Vinh Tan Problem • The vehicle routing problem involves finding a set of trips, one for each vehicle, to deliver known quantities of goods to a set of customers • The objective is to minimize the travel costs of all trips combined • There may be upper bounds on the total load of each vehicle and the total duration of its trip Contents Connectivity Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm • The most basic Vehicle Routing Problem (VRP) is the single-depot capacitate VRP Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring 9.58 Planar Graphs More About Graphs Huynh Tuong Nguyen, Tran Vinh Tan Contents Connectivity Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring 9.59 More About Graphs Planar Graphs Huynh Tuong Nguyen, Tran Vinh Tan Definition • A graph is called planar (phẳng ) if it can be drawn in the plane without any edges crossing • Such a drawing is called planar representation (biểu diễn phẳng ) of the graph Contents Connectivity Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring K4 K4 with no crossing 9.60 More About Graphs Important Corollaries Huynh Tuong Nguyen, Tran Vinh Tan Corollary • If G is a connected planar simple graph with e edges and v vertices where v ≥ 3, then e ≤ 3v − • If G is a connected planar simple graph with e edges and v vertices where v ≥ 3, and no circuits of length 3, then e ≤ 2v − Contents Connectivity Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs K3,3 Non-planar Graph Coloring K5 Non-planar 9.61 Elementary Subdivision More About Graphs Huynh Tuong Nguyen, Tran Vinh Tan Definition • Given a planar graph G, an elementary subdivision (phân chia sơ cấp) is removing an edge {u, v} and adding a new vertex w together with edges {u, w} and {w, v} • Graphs G1 = (V1 , E1 ) and G2 = (V2 , E2 ) are called homeomorphic (đồng phôi) if they can obtained from the same graph by a sequence of elementary subdivisions Contents Connectivity Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring 9.62 More About Graphs Kuratowski’s Theorem Huynh Tuong Nguyen, Tran Vinh Tan Theorem A graph is nonplanar iff it contains a subgraph homeomorphic to K3,3 or K5 Contents Connectivity Paths and Circuits Euler and Hamilton Paths a Euler Paths and Circuits f e Hamilton Paths and Circuits d j Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm g a i c b g j d f Floyd-Warshall Algorithm Ford’s algorithm h e c Traveling Salesman Problem i h Planar Graphs Graph Coloring 9.63 More About Graphs Exercise Huynh Tuong Nguyen, Tran Vinh Tan Exercise • Is K4 planar? • Is Q3 planar? Contents 110 111 Connectivity Paths and Circuits 100 Euler and Hamilton Paths 101 Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm 010 011 Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem 000 001 Planar Graphs Graph Coloring K4 Q3 9.64 More About Graphs Maps and Graphs Huynh Tuong Nguyen, Tran Vinh Tan Definition • Every map can be represented by a graph We call it dual graph Contents • Problem of coloring the regions of a map → coloring the vertices of the dual graph so that no two adjacent vertices have the same color Connectivity Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits B Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm A E C Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring D 9.65 More About Graphs Graph coloring Huynh Tuong Nguyen, Tran Vinh Tan Definition • A coloring (tô màu) of a simple graph is the assignment of a color to each vertex of the graph so that no two adjacent vertices are assigned the same color • The chromatic number (số màu) of a graph, denoted by χ(G), is the least number of colors needed for a coloring of this graph Contents Connectivity Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm a b a Bellman-Ford Algorithm b Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs g e g e f c Graph Coloring f d c d 9.66 Four color theorem More About Graphs Huynh Tuong Nguyen, Tran Vinh Tan Theorem (Four color theorem) The chromatic number of a planar graph is no greater than four • Was a conjecture in the 1850s • Was not proved completely until 1976 by Kenneth Appel and Wolfgang Haken, using computer • No proof not relying on a computer has yet been found Contents Connectivity Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring 9.67 More About Graphs Applications of Graph coloring Huynh Tuong Nguyen, Tran Vinh Tan Scheduling Final Exam • How can the final exams at a university be scheduled so that no student has two exams at the same time? • Suppose we have finals, numbered through • The pairs of courses have common students are depicted in Contents Connectivity the following graph Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring 9.68 Applications of Graph Coloring More About Graphs Huynh Tuong Nguyen, Tran Vinh Tan Other Applications Contents • Frequency Assignments: Television channels through 12 are assigned to stations in North America so that no two stations within 150 miles can operate on the same channel How can the assignment of channels be modeled by graph coloring? • Index Registers: In an execution of loop, the frequently used variables should be stored in index registers to speed up How many index registers are needed? Connectivity Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs Graph Coloring 9.69 [...]... of Seven Bridges of K¨onigsberg can be also stated: Does Euler Path exist in the graph? Contents Connectivity Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits • Euler Circuit (chu trình Euler ) is a path in the graph that passes each edge only once and return back to its original position From Definition, Euler Circuit is a subset of Euler Path Hamilton Paths and Circuits Shortest... circuit! Rule 1 if deg(v) = 2, both edge must be used Contents Connectivity Paths and Circuits v Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Rule 2 No subcircuit (chu trình con) can be formed Shortest Path Problem Dijkstra’s Algorithm Rule 3 Once two edges at a vertex v is determined, all other edges incident at v must be removed v Bellman-Ford Algorithm Floyd-Warshall ... Chung Ki-hong and Hur Joon-seok from KAIST Paths and Circuits Euler and Hamilton Paths Euler Paths and Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford... Dijkstra’s Algorithm = 000 = 100 Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Coordinate of each vertex is 3-digit binary sequences Coordinates of... Circuits Hamilton Paths and Circuits Shortest Path Problem Dijkstra’s Algorithm Bellman-Ford Algorithm Floyd-Warshall Algorithm Ford’s algorithm Traveling Salesman Problem Planar Graphs Planar

Ngày đăng: 08/12/2016, 20:47

TỪ KHÓA LIÊN QUAN