DEFINITION OF GRAPH GRAPH THEORY Prepared by Engr. JP Timola Reference: Discrete Math by Kenneth H. Rosen A graph G = (V,E) consists of V, a nonempty set of vertices (or nodes) and E, a set of edges. Each edge has either one or two vertices associated with it, called its endpoints. An edge is said to connect its endpoints. EXAMPLE a network is made up of data centers and communication links between computers THEIR VERTICES AND EDGES Simple graph graph in which each edge connects two different vertices and where no two edges connect the same pair of vertices THEIR VERTICES AND EDGES Multigraphs Graphs that may have multiple edges connecting the same vertices THEIR VERTICES AND EDGES Pseudographs Graphs that may include loops, and possibly multiple edges connecting the same pair of vertices or a vertex to itself
DEFINITION Directed Graph (or Digraph) consists of a non-empty set of vertices V and a set of directed edges (or arcs) E. Each directed edge is associated with an ordered pair of vertices. The directed edge associated with the ordered pair (u, v) is said to start at u and end at v. THEIR DIRECTION Simple Directed Graph When a directed graph has no loops and has no multiple directed edges Because a simple directed graph has at most one edge associated to each ordered pair of vertices (u, v), we call (u, v) an edge if there is an edge associated to it in the graph. THEIR DIRECTION Directed multigraphs may have multiple directed edges from a vertex to a second vertex When there are m directed edges, each associated to an ordered pair of vertices (u, v), we say that (u, v) is an edge of multiplicity m. THEIR DIRECTION Mixed Graph. graph with both directed and undirected d edges For some models that may need a graph where some edges are undirected, while others are directed. EXERCISE 1. Draw graph models, stating the type of graph used, to represent airline routes where every day there are four flights from Manila to Palawan, two flights from Palawan to Manila, three flights from Palawan to Butuan, two flights from Butuan to Palawan, one flight from Palawan to Cebu, two flights from Cebu to Palawan, three flights from Palawan to Bohol, two flights from Bohol to Palawan, and one flight from Bohol to Butuan, with
EXERCISE a) an edge between vertices representing cities that have a flight between them (in either direction). b) an edge between vertices representing cities for each flight that operates between them (in either direction). EXERCISE 2)What kind of graph can be used to model a highway system between major cities where a) there is an edge between the vertices representing cities if there is an interstate highway between them? b) there is an edge between the vertices representing cities for each interstate highway between them? DEFINITION 1 Basic Terminology Two vertices u and v in an undirected graph G are called adjacent (or neighbors) in G if u and v are endpoints of an edge e of G. Such an edge e is called incident with the vertices u and v and e is said to connect u and v. DEFINITION 2 Basic Terminology The set of all neighbors of a vertex v of G = (V,E), denoted by N(v), is called the neighborhood of v. If A is a subset of V, we denote by N(A) the set of all vertices in G that are adjacent to at least one vertex in A. So, N(A) = U v A N(v). DEFINITION 3 Basic Terminology 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). Example What are the degrees and what are the neighborhoods of the vertices in the graphs G and H?
Other terms A vertex of degree zero is called isolated. It follows that an isolated vertex is not adjacent to any vertex. A vertex is pendant if and only if it has degree one. Consequently, a pendant vertex is adjacent to exactly one other vertex. THEOREM 1 THE HANDSHAKING THEOREM Let G = (V,E) be an undirected graph with m edges. Then 2m deg( v) vv Example How many edges are there in a graph with 10 vertices each of degree six? THEOREM 2 An undirected graph has an even number of vertices of odd degree. DEFINITION 4 When (u, v) is an edge of the graph G with directed edges, u is said to be adjacent to v and v is said to be adjacent from u. The vertex u is called the initial vertex of (u, v), and v is called the terminal or end vertex of (u, v). The initial vertex and terminal vertex of a loop are the same. DEFINITION 5 In a graph with directed edges the indegree 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.
EXAMPLE Find the in-degree and out-degree of each vertex in the graph G with directed edges shown THEOREM 3 Let G = (V,E) be a graph with directed edges. Then vv deg ( v) deg ( v) E vv Complete Graphs simple graph that contains exactly one edge between each pair of distinct vertices. Cycles A cycle C n, n 3, consists of n vertices and edges Wheels We obtain a wheel W n when we add an additional vertex to a cycle C n, for n 3,and connect this new vertex to each of the n vertices in C n, by new edges. n-cubes is a graph that has vertices representing the 2 n bit strings of length n.
DEFINITION 6 A simple graph G is called bipartite if its vertex set V can be partitioned into two disjoint sets V1 and V2 such that every edge in the graph connects a vertex in V1 and a vertex in V2 (so that no edge in G connects either two vertices in V1 or two vertices in V2). When this condition holds, we call the pair (V1, V2) a bipartition of the vertex set V of G. THEOREM 4 A simple graph is bipartite if and only if it is possible to assign one of two different colors to each vertex of the graph so that no two adjacent vertices are assigned the same color. Are G and H bipartite? No. G is a bipartite while H is not. THEOREM 5 HALL S MARRIAGE THEOREM The bipartite graph G = (V,E) with bipartition(v1, V2) has a complete matching from V1 to V2 if and only if N(A) A for all subsets A of V1. DEFINITION 7 A subgraph of a graph G = (V,E) is a graph H = (W, F), where W V and F E. A subgraph H of G is a proper subgraph of G if H = G. DEFINITION 8 Let G = (V,E) be a simple graph. The subgraph induced by a subset W of the vertex set V is the graph (W, F), where the edge set F contains an edge in E if and only if both endpoints of this edge are in W.
Graph and subgraph DEFINITION 9 The union of two simple graphs G1 = (V1,E1) and G2 = (V2,E2) is the simple graph with vertex set V1 V2 and edge set E1 E2. The union of G1 and G2 is denoted by G1 G2. Graphs and their union