 # KNURE, Software department, Ph. 7021-446, N.V. Bilous Faculty of computer sciences Software department, KNURE Discrete.

## Presentation on theme: "KNURE, Software department, Ph. 7021-446, N.V. Bilous Faculty of computer sciences Software department, KNURE Discrete."— Presentation transcript:

KNURE, Software department, Ph. 7021-446, e-mail: belous@kture.kharkov.ua N.V. Bilous Faculty of computer sciences Software department, KNURE Discrete mathematics. The basic concepts of the graph theory.

N.V.Belous2. Representing graphs 2 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.Belous2. Representing graphs 3 The basic concepts Two vertices v i and v j in an undirected graph G are called adjacent (or neighbors) in G if {v i, v j } is an edge of G. If e = {v i, v j }, the edge e is called incident with the vertices v i and v j. The edges e i and e j are called a multiple or parallel edges if they are incident to the same pair of vertices. A loop is a closed edge. The vertices v i and v j are called endpoints of the edge {v i,v j }.

N.V.Belous2. Representing graphs 4 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.Belous2. Representing graphs 5 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.Belous2. Representing graphs 6 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.Belous2. Representing graphs 7 The basic concepts Example. deg(e) = 1, deg(a) = deg(c) = 2, deg(f) = 3, deg(g) = 4, deg(b) = 6, deg(d) = 0. d c b e f a G

N.V.Belous2. Representing graphs 8 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 Vertex e is pendant. Vertex d is isolated c b e f a G d

N.V.Belous2. Representing graphs 9 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.Belous2. Representing graphs 10 Graph G 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.

N.V.Belous2. Representing graphs 11 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.Belous2. Representing graphs 12 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. d e b c a

N.V.Belous2. Representing graphs 13 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.Belous2. Representing graphs 14 Types of the graphs A graph G = (V, E) is called a null-graph if the set of edges is empty. The complete graph on n vertices, denoted by K n is the simple graph that contains exactly one edge between each pair of distinct vertices. Null-graph The Graphs Kn n=1,2,…,6 k1k1 k3k3 k5k5 k4k4 k6k6 k2k2

N.V.Belous2. Representing graphs 15 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.Belous2. Representing graphs 16 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.Belous2. Representing graphs 17 Representing graphs.  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.Belous2. Representing graphs 18 Representing graphs.  Geometrical.

N.V.Belous2. Representing graphs 19 Representing graphs.  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 v i, and v j, are adjacent, and 0 as its (i,j) -th entry when they are not adjacent. In other words, if its adjacency matrix is A = [a ij ], where: 1, if {v i, v j }is an edge of G 0, otherwise a ij =

N.V.Belous2. Representing graphs 20 Representing graphs. For undirected graph G the adjacency matrix looks like: Undirected graph G v 2 v 3 v 1 v 4 v 5 e 2 e 5 e 4 e 3 e 1 e 6 e 7

N.V.Belous2. Representing graphs 21 For directed graph the adjacency matrix looks like : Representing graphs. Directed graph G e 1 e 2 e 5 v 2 v 1 e 3 e 6 v 4 v 5 e 7 v 3 e 4

N.V.Belous2. Representing graphs 22 Representing graphs.  An incidence matrices. Let G = (V, E) be an undirected graph. Suppose that v 1, v 2,…, v n are the vertices and e 1, e 2,..., e m are the edges of G. Then the incidence matrix with respect to this ordering of V and E is the n  m matrix M = [m ij ], where: 1, if edge e j is incident with v i 0, otherwise m ij =

N.V.Belous2. Representing graphs 23 Representing graphs. 1) For undirected graph b ij = 1, if vertex v i incident to an edge e j ; 0, otherwise Undirected graph G

N.V.Belous2. Representing graphs 24 Representing graphs. 2) For directed graph -1, if the edge e j enters into vertex v i ; 1, if the edge e j leaves vertex v i ; b ij = 2, if the edge e j is a loop for vertex v i ; 0, if an edge e j and v i are not incidence. Directional graph G

N.V.Belous2. Representing graphs 25 The isomorphic graphs 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. u2u2 G u4u4 u1u1 u3u3 H v2v2 v1v1 v3v3 v4v4

N.V.Belous2. Representing graphs 26 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. u2u2 G(V,E) u4u4 u1u1 u3u3 H(P,L) v2v2 v1v1 v3v3 v4v4 The isomorphic graphs

N.V.Belous2. Representing graphs 27 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. 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. c a e d c b GH a e d b

N.V.Belous2. Representing graphs 28Connectivity 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,..., e n of the graph such that f (e 1 ) = {x 0, x 1 }, f (e 2 ) = {x 1, x 2 }, …, f (e n ) = {x n-1, x n }, where x 0 =u and x n = v. For simple graph: vertex sequence x 0, x 1, …, x n.

N.V.Belous2. Representing graphs 29Connectivity 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,... x n-1. A path or circuit is simple if it does not contain the same edge more than once.

N.V.Belous2. Representing graphs 30Connectivity 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, {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. a, b, e, d, a, b is the path of length 5, but it is not simple because the edge {a, b} contains twice. d f b a e c

N.V.Belous2. Representing graphs 31Connectivity 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.Belous2. Representing graphs 32Connectivity Example, where G 1 = {v 1, v 2, v 3 }, G 2 = {v 4, v 5, v 6 } G 3 = {v 7, v 8 }. G 1, G 2,G 3 are the connected components of G v1v1 v2v2 v3v3 v4v4 v5v5 v6v6 v7v7 v8v8

N.V.Belous2. Representing graphs 33Connectivity 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, c, and e are the cut vertices of G. {a, b} and {c,e} are the cut edges. Graph G a d c b f e h g

N.V.Belous2. Representing graphs 34Connectivity 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 Example G is strongly connected H is weakly connected a e d b c a e d b c GH

Download ppt "KNURE, Software department, Ph. 7021-446, N.V. Bilous Faculty of computer sciences Software department, KNURE Discrete."

Similar presentations