Discrete mathematics The basic concepts of the graph
Discrete mathematics. The basic concepts of the graph theory. N. V. Bilous Faculty of computer sciences Software department, KNURE, Software department, Ph. 7021 -446, e-mail: belous@kture. kharkov. ua
The basic concepts A graph G = (V, E) consists of V, a nonempty set of vertices, and E, a set of unordered pairs of distinct elements of V called edges. V={v 1, v 2, v 3, v 4, v 5}; E={e 1, e 2, e 3, e 4, e 5, e 6, e 7} Graph G=(V, E) N. V. Belous 2. Representing graphs 2
The basic concepts Two vertices vi and vj in an undirected graph G are called adjacent (or neighbors) in G if {vi, vj} is an edge of G. If e = {vi, vj}, the edge e is called incident with the vertices vi and vj. N. V. Belous 2. Representing graphs 3
The basic concepts Example v 1 and v 4 are adjacent vertices. e 2 is incident with v 1 and v 4 e 1 and e 4 are parallel edges. e 5 is a loop. v 1 and v 4 are endpoints. N. V. Belous 2. Representing graphs 4
The basic concepts A subgraph is any part of a graph that itself is a graph. A subgraph of a graph G=(V, E) is a graph H=(P, R) where P V and R E. Subgraph H of a graph G N. V. Belous 2. Representing graphs 5
The basic concepts The degree of a vertex in an undirected graph is the number of edges incident with it, except that a loop at a vertex contributes twice to the degree of that vertex. The degree of the vertex v is denoted by deg(v). N. V. Belous 2. Representing graphs 6
The basic concepts Example. deg(e) = 1, deg(a) = deg(c) = 2, deg(f) = 3, deg(g) = 4, deg(b) = 6, a deg(d) = 0. N. V. Belous b c d e f G 2. Representing graphs 7
The basic concepts A vertex of degree 0 is called isolated. An isolated vertex is not adjacent to any vertex. A vertex is pendant if it has degree 1. A pendant vertex is adjacent to exactly one vertex. Example b c d Vertex e is pendant. Vertex d is isolated a e f G N. V. Belous 2. Representing graphs 8
Directed graph A directed graph (V, E) consists of a set of vertices V and a set of edges E that are ordered pairs of elements of set V. Directed graph N. V. Belous 2. Representing graphs 9
The directed graph When (v 1, v 2) is an edge of the graph G with directed edges, v 1 is said to be adjacent to v 2 and v 2 is said to be adjacent from v 1. The vertex v 1 is called the initial vertex of (v 1, v 2) and v 2 is called the terminal or end vertex of (v 1, v 2). The initial vertex and terminal vertex of a loop are the same. Directed edges are called arcs. Graph G N. V. Belous 2. Representing graphs 10
The degree of vertex In a graph with directed edges the in-degree of a vertex v denoted by deg¯(v), is the number of edges with v as their terminal vertex. The out-degree of v, denoted by deg+(v), is the number of edges with v as their initial vertex. N. V. Belous 2. Representing graphs 11
The degree of vertex Example. The in-degrees are: deg¯(a) = 2, deg¯ (b) = 3, deg¯(c) = 0, deg¯(d) = 2, deg¯(e) = 2. The out-degrees are: deg+(a) = 3, deg+(b) = 1, deg+(c) = 0, deg+(d) = 2, deg+(e) = 3. a e N. V. Belous b c d 2. Representing graphs 12
Types of the graphs A graph G = (V, E) that doesn’t contain loops and parallel edges is called a simple graph. Simple graph N. V. Belous 2. Representing graphs 13
Types of the graphs A graph G = (V, E) is called a null-graph if the set of edges is empty. Null-graph The complete graph on n vertices, denoted by Kn is the simple graph that contains exactly one edge between each pair of distinct vertices. k 1 k 2 k 3 k 4 k 5 k 6 The Graphs Kn n=1, 2, …, 6 N. V. Belous 2. Representing graphs 14
Types of the graphs A graph G is multigraph if it contains parallel edges. A multigraph G = (V, E) consists of a set V of vertices, a set E of edges, and a function f from E to {{u, v} | u, v V, u v}. The edges e 1 and e 2 are called multiple or parallel edges if f(e 1) = f(e 2). Multigraph N. V. Belous 2. Representing graphs 15
Types of the graphs A graph G is pseudograph if it contains loops and parallel edges. A pseudograph G = (V, E) consists of a set V of vertices, a set E of edges, and a function f from E to {{u, v} | u, v V}. An edge is a loop if f(e) = {u, u} = ={u} for some u V. Pseudograph N. V. Belous 2. Representing graphs 16
Representing graphs. w The obvious set of the graph as algebraic system. To set graph, it is enough for each edge to specify two-element set of vertices. {{a, b}, {b, c}, {a, c}, {c, d}} N. V. Belous 2. Representing graphs 17
Representing graphs. w Geometrical. N. V. Belous 2. Representing graphs 18
Representing graphs. w An adjacency matrix . The adjacency matrix A of G, with respect to this listing of the vertices, is the n n zero-one matrix with 1 as its (i, j) -th entry when vi, and vj, are adjacent, and 0 as its (i, j) -th entry when they are not adjacent. In other words, if its adjacency matrix is A = [aij], where: aij = 1, if {vi, vj }is an edge of G 0, otherwise N. V. Belous 2. Representing graphs 19
Representing graphs. For undirected graph G the adjacency matrix looks like: e 2 v 2 e 5 e 1 v 3 e 7 e 3 e 4 e 6 v 4 v 5 Undirected graph G N. V. Belous 2. Representing graphs 20
Representing graphs. For directed graph the adjacency matrix looks like : e 3 v 2 e 1 v 1 e 2 e 5 e 4 v 3 e 7 e 6 v 5 v 4 Directed graph G N. V. Belous 2. Representing graphs 21
Representing graphs. w An incidence matrices. Let G = (V, E) be an undirected graph. Suppose that v 1, v 2, …, vn are the vertices and e 1, e 2, . . . , em are the edges of G. Then the incidence matrix with respect to this ordering of V and E is the n m matrix M = [mij], where: mij = N. V. Belous 1, if edge ej is incident with vi 0, otherwise 2. Representing graphs 22
Representing graphs. 1) For undirected graph bij= 1, if vertex vi incident to an edge ej; 0, otherwise Undirected graph G N. V. Belous 2. Representing graphs 23
Representing graphs. 2) For directed graph -1, if the edge ej enters into vertex vi ; 1, if the edge ej leaves vertex vi ; bij= 2, if the edge ej is a loop for vertex vi ; 0, if an edge ej and vi are not incidence. Directional graph G N. V. Belous 2. Representing graphs 24
Isomorphism of graphs The simple graphs G 1 = (V 1, E 1 ) and G 2 = (V 2, E 2 ) are isomorphic if there is a one-to-one function from V 1 to V 2 with the property that a and b are adjacent in G 1 if and only if f(a) and f (b) are adjacent in G 2 for all a and b in V 1. Such a function f is called an isomorphism. u 1 u 4 v 1 v 2 v 3 v 4 u 2 u 3 G N. V. Belous H The isomorphic graphs 2. Representing graphs 25
Isomorphism of graphs The function f with f (u 1) = v 1, f (u 2)= v 4, f (u 3)= v 3 and f (u 4)= v 2, is a one-to-one correspondence between V and P. This correspondence preserves adjacency, note that adjacent vertices in G are u 1 and u 2, u 1 and u 3, u 2 and u 4, u 3 and u 4. Each of the pairs f(u 1)= v 1, and f (u 2)= v 4, f (u 1)= v 1 and f (u 3)= v 3, f (u 2)= v 4 and f (u 4)= v 2, f (u 3)= v 3 and f (u 4)= v 2 are adjacent in H. u 1 u 4 v 1 v 2 u 3 G(V, E) N. V. Belous The isomorphic graphs v 3 H(P, L) v 4 2. Representing graphs 26
Isomorphism of graphs Often show that two simple graphs are not isomorphic by showing that they do not share a property that isomorphic simple graphs must both have. Such a property is called an invariant with respect to isomorphism of simple graphs. b b a c e d G H G and H have five vertices and six edges. H has a vertex of degree 1, namely, e, whereas G has no vertices of degree 1. It follows that G and H are not isomorphic. N. V. Belous 2. Representing graphs 27
Connectivity A path of length n, in an undirected graph, from u to v, where n is a positive integer, is a sequence of edges e 1, . . . , en of the graph such that f (e 1) = {x 0, x 1}, f (e 2) = {x 1, x 2}, … , f (en ) = {xn-1, xn}, where x 0 =u and xn = v. For simple graph: vertex sequence x 0, x 1, …, xn. N. V. Belous 2. Representing graphs 28
Connectivity The path is a circuit if it begins and ends at the same vertex, that is, if u = v. The path or circuit is said to pass through or traverse the vertices x 1, x 2, . . . xn-1. A path or circuit is simple if it does not contain the same edge more than once. N. V. Belous 2. Representing graphs 29
Connectivity Example a, d, c, f, e is a simple path of length 4, in which {a, d}, {d, c}, {c, f}, and {f, e} are all edges. d, e, c, a is not a path, a b c {e, c} is not an edge. b, c, f, e, b is a circuit of length 4. {b, c}, {c, f}, {f, e}, and {e, b} are edges of this path, this path begins and ends at b. d f e a, b, e, d, a, b is the path of length 5, but it is not simple because the edge {a, b} contains twice. N. V. Belous 2. Representing graphs 30
Connectivity An undirected graph is called connected if there is a path between every pair of distinct vertices of the graph. A graph that is not connected is the union of two or more connected subgraphs each pair of which has no vertex in common. These disjoint connected subgraphs are called the connected components of the graph. N. V. Belous 2. Representing graphs 31
Connectivity Example v 1 , where v 2 G 1 = {v 1, v 2, v 3}, v 5 G 2 = {v 4, v 5, v 6} G 3 = {v 7, v 8}. v 7 G 1, G 2 , G 3 are the connected components of G N. V. Belous 2. Representing graphs v 4 v 3 v 6 v 8 32
Connectivity The removal of a vertex and all edges incident with it produces a subgraph with more connected components than in the original graph. Such vertices are called cut vertices (or articulation points). An edge whose removal produces a graph with more connected components than in the original graph is called a cut edge or bridge. Example b a b, c, and e are the cut vertices of G. f g {a, b} and {c, e} are the cut edges. d Graph G N. V. Belous 2. Representing graphs c e 33 h
Connectivity A directed graph is strongly connected if there is a path from a to b and from b to a whenever a and b are vertices in the graph. A directed graph is weakly connected if there is a path between any two vertices in the underlying undirected graph a b Example c c G is strongly connected H is weakly connected e e d d G N. V. Belous 2. Representing graphs H 34
- Slides: 34