Introduction to Graphs Introduction to Graphs Huynh Tuong Nguyen, Tran Vinh Tan Contents Graph definitions Terminology Special Simple Graphs Representing Graphs and Graph Isomorphism Representing Grap[.]
Trang 1Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Discrete Structures for Computing on October 27, 2015
Huynh Tuong Nguyen, Tran Vinh TanFaculty of Computer Science and Engineering
Trang 2Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Special Simple Graphs
2 Representing Graphs and Graph Isomorphism
Trang 3Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Trang 4Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
A graph (đồ thị)Gis a pair of(V, E), which are:
• V – nonempty set ofvertices(nodes) (đỉnh)
234
Trang 5Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Undirected Graph (Đồ thị vô hướng)
Definition (Simple graph (đơn đồ thị))
• Each edge connects two different vertices, and
• No two edges connect the same pair of vertices
An edge between two vertices u and v is denoted as {u, v}
Trang 6Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Definition (Multigraph (đa đồ thị))
Graphs that may have multiple edges connecting the same vertices
An unordered pair of vertices {u, v} are calledmultiplicity m(bội
m) if it has m different edges between
Trang 7Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Definition (Pseudograph (giả đồ thị))
Are multigraphs that have
• loops(khuyên)– edges that connect a vertex to itself
Trang 8Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Definition (Directed Graph (đồ thị có hướng))
A directed graphGis a pair of (V, E), in which:
• V – nonempty set of vertices
• E – set of directed edges (cạnh có hướng )
A directed edgestartat u andendat v is denoted as (u, v)
Trang 9Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
In an undirected graph G = (V, E),
• two verticesuandv ∈ V are calledadjacent(liền kề ) if they
areend-points(điểm đầu mút) of edgee ∈ E, and
• eisincident with(cạnh liên thuộc)uandv
• eis said toconnect (cạnh nối )uandv;
The degree of a vertex
Thedegree of a vertex(bậc của một đỉnh), denoted bydeg(v)is
the number of edges incident with it, except that a loop
contributes twice to the degree of that vertex
• isolatedvertex (đỉnh cô lập): vertex of degree0
• pendantvertex (đỉnh treo): vertex of degree1
Trang 10Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
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},
Trang 11Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Theorem (The Handshaking Theorem)
LetG = (V, E) be an undirected graph withmedges Then
Trang 12Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
In an directed graph G = (V, E),
• uis said to beadjacent to(nôi tới )v andv is said to be
adjacent from (được nối từ)uif(u, v)is an edge ofG, and
• uis calledinitial vertex(đỉnh đầu) of(u, v)
• v is calledterminal (đỉnh cuối ) orend vertexof(u, v)
• the initial vertex and terminal vertex of a loop are the same
The degree of a vertex
In a graph G with directed edges:
• in-degree(bậc vào) of a vertexv, denoted bydeg−(v), is
the number of edges withv as their terminal vertex
• out-degree(bậc ra) of a vertex v, denoted bydeg+(v), is
the number of edges withv as their initial vertex
Note: a loop at a vertex contributes 1to both the in-degree and
the out-degree of this vertex
Trang 13Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Trang 14Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
A complete graph (đồ thị đầy đủ ) on n vertices, Kn, is a simple
graph that containsexactly one edge between each pair of distinct
vertices
Trang 15Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
A cycle (đồ thị vòng ) Cn, n ≥ 3, consists of n vertices
v1, v2, , vn and edges {v1, v2}, {v2, v3}, , {vn−1, vn}, and
{vn, v1}
Trang 16Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
We obtain a wheel (đồ thị hình bánh xe) Wn when we add an
additional vertex to a cycle Cn, for n ≥ 3, and connect this new
vertex to each of the n vertices in Cn
Trang 17Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
An n-dimensional hypercube (khối n chiều), Qn, is a graph that
has vertices representing the 2n bit strings of length n Two
vertices are adjacent iff the bit strings that they represent differ in
exactly one bit position
Q1
1110
Q2
101100
111110
Q3
Trang 18Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Applications of Special Graphs
• Local networks topologies
• Star, ring, hybrid
• Parallel processing
• Linear array
• Mesh network
Trang 19Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
A simple graphGis called bipartite (đồ thị phân đôi ) if its vertex
setV can be partitioned into two disjoint setsV1andV2 such that
every edge in the graph connects a vertex inV1and a vertex inV2
(so that no edge inGconnects either two vertices inV1 or two
vertices inV2)
Example
C6 is bipartite
C6
Trang 20Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
A complete bipartite Km,nis a graph that
• has its vertex set partitioned intotwo subsetsof m and n
vertices, respectively,
• with an edge between two vertices iff one vertex is in the first
subset and the other is in the second one
K3,3
Trang 21Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Trang 22Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Theunion(hợp) of two simple graphsG1= (V1, E1)and
G2= (V2, E2)is a simple graph with vertex setV1∪ V2and edge
setE1∪ E2 The union ofG1andG2is denoted byG1∪ G2
Trang 23Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Adjacency Lists (Danh sách kề)
Vertex Adjacent vertices
Trang 24Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
a b c da
bcd
Trang 25Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Trang 26Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Trang 27Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Trang 28Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
F
G
Trang 29Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
G1= (V1, E1)andG2= (V2, E2)areisomorphic(đẳng cấu) if
there is aone-to-one functionf fromV1 toV2 with the property
that a and b are adjacent inG1iiff (a) andf (b)are adjacent in
G2, for allaandb inV1 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.)
Trang 30Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Trang 31Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Trang 32Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
G1
C
DE
F
G2
Trang 33Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
G2
Trang 34Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Trang 35Huynh Tuong Nguyen, Tran Vinh Tan
Contents Graph definitions
Terminology
Special Simple Graphs
Representing Graphs and Graph Isomorphism
Determine whether the graphs without loops with the incidence
matrices are isomorphic
• Extend the definition of isomorphism of simple graphs to
undirected graphs containing loops and multiple edges
• Define isomorphism of directed graphs