Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 36 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
36
Dung lượng
393,87 KB
Nội dung
Introduction to Graphs Huynh Tuong Nguyen, Tran Vinh Tan Chapter Introduction to Graphs Discrete Structures for Computing on December 14, 2014 Contents Graph definitions Terminology Special Simple Graphs Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Graph Bipartie graph Isomorphism Huynh Tuong Nguyen, Tran Vinh Tan Faculty of Computer Science and Engineering University of Technology - VNUHCM 8.1 Contents Introduction to Graphs Huynh Tuong Nguyen, Tran Vinh Tan Graph definitions Terminology Special Simple Graphs Contents Graph definitions Terminology Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Special Simple Graphs Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Exercise Graph Bipartie graph Isomorphism Graph Bipartie graph Isomorphism 8.2 Motivations Introduction to Graphs Huynh Tuong Nguyen, Tran Vinh Tan The need of the graph • Representation/Storing • Searching/sorting • Optimization Contents Graph definitions Terminology Special Simple Graphs Its applications Representing Graphs and Graph Isomorphism Representing Graphs • Electric circuit/board Graph Isomorphism Exercise • Chemical structure Graph Bipartie graph • Networking Isomorphism • Map, geometry • 8.3 Introduction to Graphs Graph Huynh Tuong Nguyen, Tran Vinh Tan Definition A graph (đồ thị) G is a pair of (V, E), which are: Contents Graph definitions • V – nonempty set of vertices (nodes) (đỉnh) Terminology Special Simple Graphs • E – set of edges (cạnh) A graph captures abstract relationships between vertices Representing Graphs and Graph Isomorphism Representing Graphs 2 4 Graph Isomorphism Exercise Graph Bipartie graph 3 Isomorphism 8.4 Undirected Graph (Đồ thị vô hướng) Introduction to Graphs Huynh Tuong Nguyen, Tran Vinh Tan Definition (Simple graph (đơn đồ thị)) • Each edge connects two different vertices, and • No two edges connect the same pair of vertices Contents Graph definitions Terminology Special Simple Graphs An edge between two vertices u and v is denoted as {u, v} Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Graph Bipartie graph Isomorphism 8.5 Undirected Graph Introduction to Graphs Huynh Tuong Nguyen, Tran Vinh Tan Definition (Multigraph (đa đồ thị)) Graphs that may have multiple edges connecting the same vertices Contents Graph definitions An unordered pair of vertices {u, v} are called multiplicity m (bội m) if it has m different edges between Terminology Special Simple Graphs Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Graph Bipartie graph Isomorphism 8.6 Undirected Graph Introduction to Graphs Huynh Tuong Nguyen, Tran Vinh Tan Definition (Pseudograph (giả đồ thị)) Are multigraphs that have • loops (khuyên)– edges that connect a vertex to itself Contents Graph definitions Terminology Special Simple Graphs Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Graph Bipartie graph Isomorphism 8.7 Directed Graph Introduction to Graphs Huynh Tuong Nguyen, Tran Vinh Tan Definition (Directed Graph (đồ thị có hướng)) A directed graph G is a pair of (V, E), in which: • V – nonempty set of vertices • E – set of directed edges (cạnh có hướng ) Contents Graph definitions Terminology Special Simple Graphs A directed edge start at u and end at v is denoted as (u, v) Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Graph Bipartie graph Isomorphism 8.8 Terminologies For Undirected Graph Introduction to Graphs Huynh Tuong Nguyen, Tran Vinh Tan Neighborhood In an undirected graph G = (V, E), • two vertices u and v ∈ V are called adjacent (liền kề ) if they are end-points (điểm đầu mút) of edge e ∈ E, and • e is incident with (cạnh liên thuộc) u and v • e is said to connect (cạnh nối) u and v; The degree of a vertex The degree of a vertex (bậc đỉnh), denoted by deg(v) is the number of edges incident with it, except that a loop contributes twice to the degree of that vertex Contents Graph definitions Terminology Special Simple Graphs Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Graph Bipartie graph Isomorphism • isolated vertex (đỉnh cô lập): vertex of degree • pendant vertex (đỉnh treo): vertex of degree 8.9 Introduction to Graphs Example Huynh Tuong Nguyen, Tran Vinh Tan Example What are the degrees and neighborhoods of the vertices in these graphs? b c d a c b Contents Graph definitions Terminology Special Simple Graphs a f G e g e d H Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Solution Graph Bipartie graph In G, deg(a) = 2, deg(b) = deg(c) = deg(f ) = 4, deg(d) = 1, Neiborhoods of these vertices are N (a) = {b, f }, N (b) = {a, c, e, f }, In H, deg(a) = 4, deg(b) = deg(e) = 6, deg(c) = 1, Neiborhoods of these vertices are N (a) = {b, d, e}, N (b) = {a, b, c, d, e}, Isomorphism 8.10 Bipartite graphs Introduction to Graphs Huynh Tuong Nguyen, Tran Vinh Tan Example (Bipartite graphs?) • C6 • Cn • K3 • Kn • the following graph Contents Graph definitions Terminology Special Simple Graphs Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Graph Bipartie graph Isomorphism 8.22 Introduction to Graphs New Graph From Old Huynh Tuong Nguyen, Tran Vinh Tan Definition A subgraph (đồ thị con) of a graph G = (V, E) is a graph H = (W, F ) where W ⊆ V and F ⊆ E Contents Definition Graph definitions Terminology The union (hợp) of two simple graphs G1 = (V1 , E1 ) and G2 = (V2 , E2 ) is a simple graph with vertex set V1 ∪ V2 and edge set E1 ∪ E2 The union of G1 and G2 is denoted by G1 ∪ G2 Special Simple Graphs Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Graph Bipartie graph Isomorphism G1 G2 G1 ∪ G2 8.23 Introduction to Graphs Adjacency Lists (Danh sách kề) Huynh Tuong Nguyen, Tran Vinh Tan Vertex a b c d e Adjacent vertices b, c, e a a, d, e c, e a, c, d Initial vertex a b c d e Terminal vertices b, c, d, e b, d a, c, e c, e b, c, d Contents Graph definitions Terminology Special Simple Graphs Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Graph Bipartie graph Isomorphism 8.24 Introduction to Graphs Adjacency Matrices Huynh Tuong Nguyen, Tran Vinh Tan Definition Adjacency matrix (Ma trận kề ) AG of G = (V, E) • Dimension |V | × |V | • Matrix elements aij = if (vi , vj ) ∈ E otherwise Contents Graph definitions Terminology Special Simple Graphs a Representing Graphs and Graph Isomorphism b Representing Graphs Graph Isomorphism a b c d c a 1 b c 1 1 0 d 0 Exercise Graph Bipartie graph Isomorphism d 8.25 Introduction to Graphs Examples Huynh Tuong Nguyen, Tran Vinh Tan Example Give the graph defined by the following adjacency matrix Contents Graph definitions A B C D Special Simple Graphs A B C D E Terminology E 0 1 0 0 1 0 1 1 0 Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Graph Bipartie graph Isomorphism 8.26 Introduction to Graphs Adjacency Matrices Huynh Tuong Nguyen, Tran Vinh Tan Example Give the directed graph defined by the following adjacency matrix Contents Graph definitions A B C D Special Simple Graphs A B C D E Terminology E 1 1 0 1 0 1 0 0 0 Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Graph Bipartie graph Isomorphism 8.27 Introduction to Graphs Incidence Matrices Huynh Tuong Nguyen, Tran Vinh Tan Definition Incidence matrix (ma trận liên thuộc) MG of G = (V, E) • Dimension |V | × |E| • Matrix elements mij = if ej is incident with vi otherwise Contents Graph definitions Terminology Special Simple Graphs a e2 Representing Graphs and Graph Isomorphism b Representing Graphs Graph Isomorphism e1 c a b c d e4 e3 e1 1 e2 1 0 e3 0 e4 1 Exercise Graph Bipartie graph Isomorphism d 8.28 Introduction to Graphs Examples Huynh Tuong Nguyen, Tran Vinh Tan Example Give the incidence matrix according to the following graph Contents Graph definitions F Terminology Special Simple Graphs B C Representing Graphs and Graph Isomorphism Representing Graphs A Graph Isomorphism Exercise Graph Bipartie graph E D Isomorphism G 8.29 Introduction to Graphs Graph Isomorphism Huynh Tuong Nguyen, Tran Vinh Tan Definition G1 = (V1 , E1 ) and G2 = (V2 , E2 ) are isomorphic (đẳng cấu) if there is a one-to-one function f from V1 to V2 with the property that a and b are adjacent in G1 iif f (a) and f (b) are adjacent in G2 , for all a and b in V1 Such a function f is called an isomorphism (một đẳng cấu) (i.e there is a one-to-one correspondence between vertices of the two graphs that preserves the adjacency relationship.) Contents Graph definitions Terminology Special Simple Graphs Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism u1 u3 u2 v1 u4 v3 v2 v4 Exercise Isomorphism function f : U −→ V with f (u1 ) = v1 f (u2 ) = v4 f (u3 ) = v3 f (u4 ) = v2 Graph Bipartie graph Isomorphism 8.30 Bipartie graph Introduction to Graphs Huynh Tuong Nguyen, Tran Vinh Tan Contents Graph definitions Terminology Special Simple Graphs Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Graph Bipartie graph Isomorphism 8.32 Isomorphism ? Introduction to Graphs Huynh Tuong Nguyen, Tran Vinh Tan Contents Graph definitions Terminology Special Simple Graphs Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Graph Bipartie graph Isomorphism 8.33 Introduction to Graphs Isomorphism? Huynh Tuong Nguyen, Tran Vinh Tan A A Contents B Graph definitions B Terminology Special Simple Graphs F C C Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise D F E E D G2 Graph Bipartie graph Isomorphism G1 8.34 Introduction to Graphs Isomorphism? Huynh Tuong Nguyen, Tran Vinh Tan A A B Contents Graph definitions Terminology Special Simple Graphs D E E F F Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Graph C B G1 D C G2 Bipartie graph Isomorphism 8.35 Introduction to Graphs Isomorphism Huynh Tuong Nguyen, Tran Vinh Tan Are the simple isomorphic ? 0 0 1 0 1 0 graphs with the following adjacency matrices 1 0 0 1 1 0 1 1 0 0 1 0 0 1 0 0 1 Contents Graph definitions Terminology Special Simple Graphs 1 Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Graph Bipartie graph Isomorphism 8.36 Isomorphism Introduction to Graphs Huynh Tuong Nguyen, Tran Vinh Tan Determine whether the graphs without loops with the incidence matrices are isomorphic 1 1 • 1 1 1 0 1 0 0 0 1 1 • 0 1 0 1 1 1 • Extend the definition of isomorphism of simple graphs to undirected graphs containing loops and multiple edges Contents Graph definitions Terminology Special Simple Graphs Representing Graphs and Graph Isomorphism Representing Graphs Graph Isomorphism Exercise Graph Bipartie graph Isomorphism • Define isomorphism of directed graphs 8.37